Importing a class without knowing the module

Mike Meyer mwm at
Sat Nov 19 02:48:06 CET 2005

aleax at (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
thread. Referencing class.__file__ instead of module.__file__ was a
mistake, but not an assertion. In fact, when I did that, I asked the
OP what was wrong with it.

You have read into some of the things I've written assertions which
simply weren't there.  For instance, I said "you may not have the
module name", which led you to ask for an example of a class without
an __module__ attribute. I never asserted that you could get a class
without a __module__ attribute, merely that you could get classes
where the module name wasn't useful. if you had spent your time
reading the text a bit more carefully, you might have saved us both
some time.

Mike Meyer <mwm at>
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.

More information about the Python-list mailing list