On Tue, 2 Dec 2008 at 23:21, Faheem Mitha wrote: > Yes, I was looking for this, and printed out obj.__dict__ but didn't > see it there. A dictionary of attributes is very useful in theory, but > doesn't always seem to have all attributes. Is this documented > anywhere?
Try dir(obj). You'll see it there. The __dict__ is only for instance attributes. >> Not too difficult. You can also use type(obj) instead of >> obj.__class__. > > I thought of trying this, but didn't. It didn't seem likely to work, > anyway. Is either of these preferred over the other in terms of API > stability, and if so, why? obj.__class__ is a python thing, as is type(obj), and neither of those is changing in python 3.0, so I'd think both would be stable API wise :) However, the documentation of __class__ makes it clear you get the class back, while the documentation of the 'type' built in function does not...so I'd lean toward using __class__, myself. It also means you'll get an earlier error if you accidentally pass something that is not actually a class instance into your function. --RDM --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---