[Python-Dev] SWIG and rlcompleter

Guido van Rossum gvanrossum at gmail.com
Wed Aug 17 22:46:27 CEST 2005

> > A more useful relationship is
> >
> >     name in dir(x) <==> getattr(x, name) is valid

> That would be a useful invariant.

Well, the <== part can't really be guaranteed due to the existence of
__getattr__  overriding (and all bets are off if __getattribute__ is
overridden!), but apart from those, stripping non-strings in dir()
would be a big help towards making the invariant true. So I'm +1 on

--Guido van Rossum (home page: http://www.python.org/~guido/)

More information about the Python-Dev mailing list