This is what you actually get on 2.7.1:
$ python Python 2.7.1 (r271:86832, Mar 24 2011, 22:44:47) [GCC 4.4.5] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> class Foo: ... def __dir__(self): ... return ['a', 'b', 'c'] ... >>> class Bar: ... def __dir__(self): ... return ('a', 'b', 'c') ... >>> print dir(Foo()) ['__dir__', '__doc__', '__module__'] >>> print dir(Bar()) ['__dir__', '__doc__', '__module__']
So __dir__ was actually completely broken on old-style classes in 2.7.1. You're only seeing the behavior it would have had if __dir__ worked.
This is what you actually get on 2.7.1:
$ python
Python 2.7.1 (r271:86832, Mar 24 2011, 22:44:47)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> class Foo:
... def __dir__(self):
... return ['a', 'b', 'c']
...
>>> class Bar:
... def __dir__(self):
... return ('a', 'b', 'c')
...
>>> print dir(Foo())
['__dir__', '__doc__', '__module__']
>>> print dir(Bar())
['__dir__', '__doc__', '__module__']
So __dir__ was actually completely broken on old-style classes in 2.7.1. You're only seeing the behavior it would have had if __dir__ worked.