Re: __iadd__ useless in sub-classed int

2007-12-10 Thread A.T.Hofkamp
On 2007-12-06, samwyse <[EMAIL PROTECTED]> wrote: > On Dec 6, 1:12 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > And that's my complaint. The value in is being replaced by > something almost, but not quite, identical to the original value. > Python's internal implementation of __iadd__ for

Re: __iadd__ useless in sub-classed int

2007-12-07 Thread MonkeeSage
On Dec 7, 12:45 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Fri, 07 Dec 2007 03:01:28 -0300, MonkeeSage <[EMAIL PROTECTED]> > escribió: > > > I've wondered about this myself. Seems to me, to prevent clobbering > > subclasses, __iadd__ (and all of the integer and float and whatever) > >

Re: __iadd__ useless in sub-classed int

2007-12-06 Thread Gabriel Genellina
En Fri, 07 Dec 2007 03:01:28 -0300, MonkeeSage <[EMAIL PROTECTED]> escribió: > I've wondered about this myself. Seems to me, to prevent clobbering > subclasses, __iadd__ (and all of the integer and float and whatever) > methods that return new instances, should work like this (obviously I > mean

Re: __iadd__ useless in sub-classed int

2007-12-06 Thread MonkeeSage
On Dec 6, 3:02 pm, samwyse <[EMAIL PROTECTED]> wrote: > On Dec 6, 1:12 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > > > > > samwyse schrieb: > > > > For whatever reason, I need an inproved integer. Sounds easy, let's > > > just subclass int: > > > class test(int): > > >pass > > > >

Re: __iadd__ useless in sub-classed int

2007-12-06 Thread Neil Cerutti
On 2007-12-06, samwyse <[EMAIL PROTECTED]> wrote: > And that's my complaint. The value in is being replaced > by something almost, but not quite, identical to the original > value. Python's internal implementation of __iadd__ for > isn't returning , it's returning a new value belonging to > the

Re: __iadd__ useless in sub-classed int

2007-12-06 Thread Chris Mellon
On Dec 6, 2007 3:02 PM, samwyse <[EMAIL PROTECTED]> wrote: > > On Dec 6, 1:12 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > > samwyse schrieb: > > > > > For whatever reason, I need an inproved integer. Sounds easy, let's > > > just subclass int: > > > > class test(int): > > >pass >

Re: __iadd__ useless in sub-classed int

2007-12-06 Thread samwyse
On Dec 6, 1:12 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > samwyse schrieb: > > > For whatever reason, I need an inproved integer. Sounds easy, let's > > just subclass int: > > class test(int): > >pass > > > Now let's test it: > > zed=test(0) > zed.__class__ > > >

Re: __iadd__ useless in sub-classed int

2007-12-06 Thread Diez B. Roggisch
samwyse schrieb: > For whatever reason, I need an inproved integer. Sounds easy, let's > just subclass int: > class test(int): > pass > > Now let's test it: > zed=test(0) zed.__class__ > zed > 0 > > So far, so good. Now let's try incrementing: > zed+=1 ze

__iadd__ useless in sub-classed int

2007-12-06 Thread samwyse
For whatever reason, I need an inproved integer. Sounds easy, let's just subclass int: >>> class test(int): pass Now let's test it: >>> zed=test(0) >>> zed.__class__ >>> zed 0 So far, so good. Now let's try incrementing: >>> zed+=1 >>> zed 1 >>> zed.__class__ WTF??! Is this a bug