How can I determine the property attributes on a class or instance?

Steven D'Aprano steve at REMOVETHIScyber.com.au
Wed Apr 12 01:23:49 EDT 2006


Replying to myself now... how sad.

On Wed, 12 Apr 2006 15:19:17 +1000, Steven D'Aprano wrote:

> If you want a general purpose solution for an object introspection tool,
> I must admit I'm as lost as you are. The only thing I have come up with is
> this nasty hack:
> 
>>>> t.p is None
> True
>>>> dir(t.p) is dir(None) 
> False

Scrub that.

>>> dir(t.p) is dir(t.p)
False
>>> dir(None) is dir(None)
False


Which in hindsight is so obvious that I'll just slink off in embarrassment
for having made the error in the first place.


-- 
Steven.




More information about the Python-list mailing list