[Python-Dev] No __bases__ in dir()

Guido van Rossum guido at python.org
Sat Mar 15 20:10:59 CET 2008


On Sat, Mar 15, 2008 at 1:11 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> Guido van Rossum wrote:
> > This is because dir() special-cases classes, isn't it?
>> Avoiding infinite recursion in dir(type) might be fun if that special
> case was removed without due care and attention...

I wasn't suggeting removing the special-casing -- rather I was
explaining the observed behavior.
In Py3k, dir() will allow any class to makes its instances special
cases by defining __dir__().
-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-Dev mailing list

AltStyle によって変換されたページ (->オリジナル) /