how do I know to what module an object belongs?

Michal Wallace (sabren) sabren at
Fri Apr 14 03:49:41 CEST 2000

On Thu, 13 Apr 2000, Michal Wallace (sabren) wrote:

>    I know I can just as easily have them pass a reference to the
> module along with it, but I'd be happier if I could just look at the
> connection object and know which module it came from. Can I do this?

Um.. Okay....

for just about every module I've tried, I can do:

module = eval(dbc.__class__.__module__)

... EXCEPT for ODBC.Windows..

>>> dbc
<MS ODBC Manager Connection object at 76c3b0>
>>> dbc.__class__
Traceback (innermost last):
  File "<stdin>", line 1, in ?
AttributeError: __class__

what gives?


- Michal

More information about the Python-list mailing list