Question regarding re module
Tim Golden
mail at timgolden.me.uk
Thu Jun 5 14:58:35 EDT 2008
Paul McGuire wrote:
> On Jun 5, 7:11 am, Tomohiro Kusumi <kusumi.tomoh... at jp.fujitsu.com>
> wrote:
>>> It could be that the result overloads the __getattr__-method to delegate
>>> calls to some object. Thus it's not part of the outer instance.
>
> Didn't I read that Py3 will support a __dir__ method so that classes
> *could* report such pseudo-attributes in response to dir?
It's already there in 2.6:
... class X (object):
... def __init__ (self, a, b):
... self.a = a
... self.b = b
... def __dir__ (self):
... return ['a', 'b', 'c']
...
>>> dir (X (1, 2))
['a', 'b', 'c']
>>>
TJG
More information about the Python-list
mailing list