[Python-Dev] __dir__, part 2
tomerfiliba at gmail.com
Tue Nov 7 16:43:45 CET 2006
> as well as updating the documentation in various
> places (the dir and PyObject_Dir documentation, obviously, but also the list
> of magic methods in the language reference).
oops, i meant everything except that
On 11/7/06, tomer filiba <tomerfiliba at gmail.com> wrote:
> okay, everything's fixed.
> i updated the patch and added a small test to:
> On 11/7/06, Nick Coghlan <ncoghlan at gmail.com> wrote:
> > tomer filiba wrote:
> > > cool. first time i build the entire interpreter, 'twas fun :)
> > > currently i "retained" support for __members__ and __methods__,
> > > so it doesn't break anything and is compatible with 2.6.
> > >
> > > i really hope it will be included in 2.6 as today i'm using ugly hacks
> > > in RPyC to make remote objects appear like local ones.
> > > having __dir__ solves all of my problems.
> > >
> > > besides, it makes a lot of sense of define __dir__ for classes that
> > > define __getattr__. i don't think it should be pushed back to py3k.
> > >
> > > here's the patch:
> > > http://sourceforge.net/tracker/index.php?func=detail&aid=1591665&group_id=5470&atid=305470
> > As I noted on the tracker, PyObject_Dir is a public C API function, so it's
> > behaviour needs to be preserved as well as the behaviour of calling dir() from
> > Python code.
> > So the final form of the patch will likely need to include stronger tests for
> > that section of the API, as well as updating the documentation in various
> > places (the dir and PyObject_Dir documentation, obviously, but also the list
> > of magic methods in the language reference).
> > +1 on targeting 2.6, too.
> > Cheers,
> > Nick.
> > --
> > Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
> > ---------------------------------------------------------------
> > http://www.boredomandlaziness.org
More information about the Python-Dev