> First of all,why do you think the new module is deprecated?  (I can't
> find anything in the docs to indicate this.)

Its in the docs of python 2.4. I dont know about older versions:

Help on module new:

NAME
    new - Create new objects of various types.  Deprecated.

FILE
    /usr/lib/python2.4/new.py

MODULE DOCS
    /usr/share/doc/python-docs-2.4.2/html/module-new.html

DESCRIPTION
    This module is no longer required except for backward
compatibility.
    Objects of most types can now be created by calling the type
object.

> As for using MethodType in the types module:  There's nothing in the
> module documentation that suggests that you can call MethodType as a
> function as you suggest, only that it is the name of the type of
> methods of user-defined class instances..  So, while calling it might
> work, it sounds like you are using an undocumented feature...

If you look at new.py, all it does is import the functions from types
and rename them. For MethodType is goes like this

from types import MethodType as instancemethod

so instance method *is* Methodtype.

Moreover, I tried and it works ;-)

So this solution is perfect once adapted not to depend on "new".

Thanks,

Flávio

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to