23 May
2011
23 May
'11
11:58 p.m.
On Tue, 24 May 2011 04:16:44 am Michael Foord wrote:
Hello all,
I'm looking at implementing __dir__ for a class (mock.Mock as it happens) to include some dynamically added attributes, the canonical use case according to the documentation: [...] Moving the relevant parts of the implementation of dir into object.__dir__ would be one way to solve that.
I haven't yet needed to write a custom __dir__, but your proposal makes sense to me. +1 -- Steven D'Aprano