Re: Add a method to the int class

2006-07-09 Thread Terry Reedy
<[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

Re: Add a method to the int class

2006-07-09 Thread placid
[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

Add a method to the int class

2006-07-09 Thread barberomarcelo
How can I add a method to the int class? -- http://mail.python.org/mailman/listinfo/python-list