[Python-3000] Adding __format__ to object

Guido van Rossum guido at python.org
Thu Aug 16 18:33:31 CEST 2007


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 8/16/07, Paul Moore <p.f.moore at gmail.com> wrote:
> On 16/08/07, Eric Smith <eric+python-dev at trueblade.com> 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__ is in type_members (at the top of the file). You want
> object_methods (lower down). All it currently defines is __reduce__
> and __reduce_ex__ (which are in dir(object()).
>
> I've not tested (or ever used) this, so I could be wrong, of course.
> Paul.
> _______________________________________________
> Python-3000 mailing list
> Python-3000 at python.org
> http://mail.python.org/mailman/listinfo/python-3000
> Unsubscribe: http://mail.python.org/mailman/options/python-3000/guido%40python.org
>


-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-3000 mailing list