Re: Importing a class without knowing the module

2005-11-18 Thread Mike Meyer
[EMAIL PROTECTED] (Alex Martelli) writes: > You did help me to better understand some of the roots of your many > mistaken assertions in this thread, from your first "How about adding > Foo.__file__" proposal onwards, yes -- thank you. I claim I haven't made a single mistaken assertion in this th

Re: Importing a class without knowing the module

2005-11-18 Thread Alex Martelli
Mike Meyer <[EMAIL PROTECTED]> wrote: ... > I suggested using the module, and mentioned that he might not have a > better choice than to use __file__ anyway. You overlooked the mention > of __module__ to complain that __file__ wasn't his best choice, > because he could use __module__. All I did

Re: Importing a class without knowing the module

2005-11-18 Thread Mike Meyer
[EMAIL PROTECTED] (Alex Martelli) writes: > Mike Meyer <[EMAIL PROTECTED]> wrote: >... >> > How do you arrange a module so that its classes' __module__ attributes >> > don't tell you the name of the module "that would be useful", yet the >> > module's __file__ DOES give you information that you

Re: Importing a class without knowing the module

2005-11-18 Thread Alex Martelli
Mike Meyer <[EMAIL PROTECTED]> wrote: ... > > How do you arrange a module so that its classes' __module__ attributes > > don't tell you the name of the module "that would be useful", yet the > > module's __file__ DOES give you information that you can usefully > > process, heuristically I assume

Re: Importing a class without knowing the module

2005-11-18 Thread Mike Meyer
[EMAIL PROTECTED] (Alex Martelli) writes: > Mike Meyer <[EMAIL PROTECTED]> wrote: >... >> A classes __module__ attribute doesn't always tell you the name of the >> module - or at least, not a name that would be usefull for the the OPs >> use case. That's the case where you don't have the module

Re: Importing a class without knowing the module

2005-11-18 Thread Alex Martelli
Mike Meyer <[EMAIL PROTECTED]> wrote: ... > A classes __module__ attribute doesn't always tell you the name of the > module - or at least, not a name that would be usefull for the the OPs > use case. That's the case where you don't have the module name. The How do you arrange a module so that

Re: Importing a class without knowing the module

2005-11-18 Thread Franck PEREZ
On 11/18/05, Mike Meyer <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] (Alex Martelli) writes: > > Mike Meyer <[EMAIL PROTECTED]> wrote: > >... > >> >> >> How about adding Foo.__file__ to the serialized data? > >... > >> >> depends on somewhere on it. You can use the module name if you have

Re: Importing a class without knowing the module

2005-11-17 Thread Mike Meyer
[EMAIL PROTECTED] (Alex Martelli) writes: > Mike Meyer <[EMAIL PROTECTED]> wrote: >... >> >> >> How about adding Foo.__file__ to the serialized data? >... >> >> depends on somewhere on it. You can use the module name if you have it >> >> available. If not, deriving the module name from the

Re: Importing a class without knowing the module

2005-11-17 Thread Alex Martelli
Mike Meyer <[EMAIL PROTECTED]> wrote: ... > >> >> How about adding Foo.__file__ to the serialized data? ... > >> depends on somewhere on it. You can use the module name if you have it > >> available. If not, deriving the module name from the file name is > >> about the best you can do. > > I

Re: Importing a class without knowing the module

2005-11-17 Thread Mike Meyer
[EMAIL PROTECTED] (Alex Martelli) writes: > Mike Meyer <[EMAIL PROTECTED]> wrote: >> >> How about adding Foo.__file__ to the serialized data? >> > I thought about it, but it would make the XML file depend on the >> > machine... no more portability... >> They already depend on the machine. You can't

Re: Importing a class without knowing the module

2005-11-17 Thread Alex Martelli
Mike Meyer <[EMAIL PROTECTED]> wrote: ... > >> How about adding Foo.__file__ to the serialized data? > > I thought about it, but it would make the XML file depend on the > > machine... no more portability... > > They already depend on the machine. You can't take them to an arbitary > machine an

Re: Importing a class without knowing the module

2005-11-17 Thread Mike Meyer
[Format recovered from top posting.] Franck PEREZ <[EMAIL PROTECTED]> writes: > On 11/18/05, Mike Meyer <[EMAIL PROTECTED]> wrote: >> Franck PEREZ <[EMAIL PROTECTED]> writes: >> > ### My test application >> > class Foo(object): >> > #The class I'd like to serialize >> > pa

Re: Importing a class without knowing the module

2005-11-17 Thread Alex Martelli
Franck PEREZ <[EMAIL PROTECTED]> wrote: > I thought about it, but it would make the XML file depend on the > machine... no more portability... ... > > How about adding Foo.__file__ to the serialized data? Your top-posting makes this discourse weird (why put your comments BEFORE the text you're

Re: Importing a class without knowing the module

2005-11-17 Thread Franck PEREZ
I thought about it, but it would make the XML file depend on the machine... no more portability... On 11/18/05, Mike Meyer <[EMAIL PROTECTED]> wrote: > Franck PEREZ <[EMAIL PROTECTED]> writes: > > ### My test application > > class Foo(object): > > #The class I'd like to seri

Re: Importing a class without knowing the module

2005-11-17 Thread Mike Meyer
Franck PEREZ <[EMAIL PROTECTED]> writes: > ### My test application > class Foo(object): > #The class I'd like to serialize > pass > > import myMarshaller > foo = Foo() > s = myMarshaller.dumps(foo) #works fine, spits something like class = "Foo"...> > another_foo = loads(s