On 10/20/2012 10:24 AM, Peter Otten wrote:

So if you want to customise dir(Foo) you have to modify the metaclass:

>>>class Foo:
...     class __metaclass__(type):
...             def __dir__(self): return ["python"]
...
>>>dir(Foo)
['python']



Hi Peter, thanks for your answer, but it does not work (Python 3.3):

>>> class Foo:
...     class __metaclass__(type):
...         def __dir__(self): return ["python"]
...
>>> dir(Foo)
['__class__', '__delattr__', '__dict__', '__dir__', ...]

Regards,
--
Jennie
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to