what should we use instead of the 'new' module?

Robert Kern robert.kern at gmail.com
Thu Nov 13 05:13:54 CET 2008

flrump at gmail.com wrote:
> Robert,
> Appreciate your response.
> However Guido says here that types was never intended to be used like
> that:
> http://bugs.python.org/msg58023
> quote: "The types module was only ever intended for type
> checking, not for creating new instances.
> The correct solution will be to use whatever we end up deciding about
> pyvm. Certainly the types module will go."
> So that does not seem like a very long term solution to me?

Hmm. Interesting. Anyways, if adding a method to a class is the only use case 
you care about, you can just add the function itself. You don't have to make a 
method object from it.

In [14]: A.foo = foo

In [16]: a = A()

In [17]: a.foo('See?')

Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco

More information about the Python-list mailing list