Re: simple integer subclass

2010-08-05 Thread Stefan Schwarzer
Hi Andreas, On 2010-08-03 12:15, Andreas Pfrengle wrote: On 3 Aug., 03:22, Carl Banks pavlovevide...@gmail.com wrote: Thinking about it, it might really be dangerous to coerce always to int1, since sometimes I might want a normal int as result (I can't tell yet for sure). Yes, that way your

Re: simple integer subclass

2010-08-05 Thread Andreas Pfrengle
Hello everyone, thanks for all the suggestions. I did effort to redesign parts of the data structure the last days, but not all (only those I could easily keep track of in my code). For the rest I add +1 before the presentation and comment it. Seems the easiest way now. Andreas --

Re: simple integer subclass

2010-08-03 Thread Andreas Pfrengle
On 3 Aug., 03:22, Carl Banks pavlovevide...@gmail.com wrote: You are creating an object that differs from a built-in, int, in a highly misleading way that only makes sense in a very limited context, and this object's modified behavior gives no clue that it's been modified in such as way.  

Re: simple integer subclass

2010-08-03 Thread rantingrick
On Aug 3, 5:15 am, Andreas Pfrengle a.pfren...@gmail.com wrote: Seems I end up with your suggestion - if noone else has an idea ;-) START_COUNTING_FROM_HERE = 1 -- http://mail.python.org/mailman/listinfo/python-list

Re: simple integer subclass

2010-08-03 Thread Jean-Michel Pichavant
Andreas Pfrengle wrote: On 3 Aug., 03:22, Carl Banks pavlovevide...@gmail.com wrote: You are creating an object that differs from a built-in, int, in a highly misleading way that only makes sense in a very limited context, and this object's modified behavior gives no clue that it's been

Re: simple integer subclass

2010-08-03 Thread Jean-Michel Pichavant
Jean-Michel Pichavant wrote: Andreas Pfrengle wrote: On 3 Aug., 03:22, Carl Banks pavlovevide...@gmail.com wrote: You are creating an object that differs from a built-in, int, in a highly misleading way that only makes sense in a very limited context, and this object's modified behavior

Re: simple integer subclass

2010-08-03 Thread Roald de Vries
Hi Andreas, On Aug 3, 2010, at 1:52 AM, Andreas Pfrengle wrote: I'm trying to define a subclass of int called int1. An int1-object shall behave exactly like an int-object, with the only difference that the displayed value shall be value + 1 (it will be used to display array indices starting at

simple integer subclass

2010-08-02 Thread Andreas Pfrengle
I'm trying to define a subclass of int called int1. An int1-object shall behave exactly like an int-object, with the only difference that the displayed value shall be value + 1 (it will be used to display array indices starting at 1 instead of 0). Right now I have: class int1(int): def

Re: simple integer subclass

2010-08-02 Thread samwyse
On Aug 2, 6:52 pm, Andreas Pfrengle a.pfren...@gmail.com wrote: I'm trying to define a subclass of int called int1. An int1-object shall behave exactly like an int-object, with the only difference that the displayed value shall be value + 1 (it will be used to display array indices starting at

Re: simple integer subclass

2010-08-02 Thread Carl Banks
On Aug 2, 4:52 pm, Andreas Pfrengle a.pfren...@gmail.com wrote: I'm trying to define a subclass of int called int1. An int1-object shall behave exactly like an int-object, with the only difference that the displayed value shall be value + 1 (it will be used to display array indices starting at

Re: simple integer subclass

2010-08-02 Thread rantingrick
On Aug 2, 6:52 pm, Andreas Pfrengle a.pfren...@gmail.com wrote: I'm trying to define a subclass of int called int1. An int1-object shall behave exactly like an int-object, with the only difference that the displayed value shall be value + 1 (it will be used to display array indices starting at