Re: [Python-3000] Adding __format__ to object

2007-08-16 Thread Eric Smith
> Are you sure that you have changed the correct array? Yes, that was the issue. I changed the wrong array. I stupidly assumed that it was one object per file, but of course there's no valid reason to make that assumption. I'm sure I don't have the most best version of this coded up, but that

Re: [Python-3000] Adding __format__ to object

2007-08-16 Thread Christian Heimes
Eric Smith wrote: > I should have mentioned that's among the things I've already tried. > > But that appears to add methods to 'type', not to an instance of > 'object'. If you do dir(object()): > > You don't see the methods in typeobject.c (__mro__, etc). > > This is pretty much the last hurdle

Re: [Python-3000] Adding __format__ to object

2007-08-16 Thread Eric Smith
Guido van Rossum wrote: > Paul's right. I agree it's confusing that object and type are both > defined in the same file (though there's probably a good reason, given > that type is derived from object and object is an instance of type > :-). To add methods to object, add them to object_methods in t

Re: [Python-3000] Adding __format__ to object

2007-08-16 Thread Guido van Rossum
Paul's right. I agree it's confusing that object and type are both defined in the same file (though there's probably a good reason, given that type is derived from object and object is an instance of type :-). To add methods to object, add them to object_methods in that file. I've tested this. On

Re: [Python-3000] Adding __format__ to object

2007-08-16 Thread Paul Moore
On 16/08/07, Eric Smith <[EMAIL PROTECTED]> wrote: > Christian Heimes wrote: > > look at Objects/typeobject.c and grep for PyMethodDef object_methods[] > > I should have mentioned that's among the things I've already tried. [...] > You don't see the methods in typeobject.c (__mro__, etc). __mro__

Re: [Python-3000] Adding __format__ to object

2007-08-16 Thread Eric Smith
Christian Heimes wrote: > Eric Smith wrote: >> Any pointers are appreciated. Something as simple as "look at foo.c" or >> "grep for __baz__" would be good enough. > > look at Objects/typeobject.c and grep for PyMethodDef object_methods[] I should have mentioned that's among the things I've alre

Re: [Python-3000] Adding __format__ to object

2007-08-16 Thread Christian Heimes
Eric Smith wrote: > Any pointers are appreciated. Something as simple as "look at foo.c" or > "grep for __baz__" would be good enough. look at Objects/typeobject.c and grep for PyMethodDef object_methods[] Christian ___ Python-3000 mailing list Pytho

[Python-3000] Adding __format__ to object

2007-08-16 Thread Eric Smith
As part of implementing PEP 3101, I need to add __format__ to object, to achieve the equivalent of: class object: def __format__(self, format_spec): return format(str(self), format_spec) I've added __format__ to int, unicode, etc., but I can't figure out where or how to add it to