<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> How can I add a method to the int class?
You can't. The closest is to subclass int and add your method.
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
> How can I add a method to the int class?
sub class it
>>> class MyInt(int):
>>>def times(self,multiple):
>>> return self * multiple
>>>
>>> a = 2
>>> print a
2
>>> a = MyInt
How can I add a method to the int class?
--
http://mail.python.org/mailman/listinfo/python-list