[stdlib-sig] proposed removal: the types module

Facundo Batista facundobatista at gmail.com
Thu Apr 3 19:14:54 CEST 2008


2008/4/3, Jeffrey Yasskin <jyasskin at gmail.com>:

> Just to pick one, try "type(...)". It's generally clearer to take an
>  example of what you want and ask for its type, than to look in the
>  types module.

How?

For example, I have this very complex class:

>>> class C:
...     def met(self):
...             pass
...
>>> c = C()


I want, from outside to create a new method in it. So, I do the following:

>>> t = type(c.met)
>>> t()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: method expected 2 arguments, got 0


Ouch, it wasn't so easy. I realize myself I need to read the docs.
Where should I look for those docs and/or examples?

Regards,

-- 
.    Facundo

Blog: http://www.taniquetil.com.ar/plog/
PyAr: http://www.python.org/ar/


More information about the stdlib-sig mailing list