Re: Top and Bottom Values [PEP: 326]

2006-09-28 Thread Antoon Pardon
On 2006-09-28, Paul Rubin wrote: > Paul Rubin writes: >> > sys.maxint - 3 to sys.maxint + 7. I'm not sure tbl[:Top] >> > would do what it is supposed to do in those circumstances. > >> Top = object() >> class Table(list): > ... > > Oh wait, I missed the : in your tbl[:To

Re: Top and Bottom Values [PEP: 326]

2006-09-28 Thread Paul Rubin
Paul Rubin writes: > > sys.maxint - 3 to sys.maxint + 7. I'm not sure tbl[:Top] > > would do what it is supposed to do in those circumstances. > Top = object() > class Table(list): ... Oh wait, I missed the : in your tbl[:Top] example. Yeah, you could hair up Table to

Re: Top and Bottom Values [PEP: 326]

2006-09-28 Thread Paul Rubin
Antoon Pardon <[EMAIL PROTECTED]> writes: > It is something worth investigating, but I'm not sure it > will suite my purpose. You see I have a table module, > a table is like a list except the base index doesn't need > to be 0. So I could have a table that is indexable from > sys.maxint - 3 to sys.

Re: Top and Bottom Values [PEP: 326]

2006-09-28 Thread Antoon Pardon
On 2006-09-28, Georg Brandl <[EMAIL PROTECTED]> wrote: > Antoon Pardon wrote: >> On 2006-09-27, George Sakkis <[EMAIL PROTECTED]> wrote: >>> Antoon Pardon wrote: >>> What bothers me a bit about the rejection of PEP 326 is that one of the reasons stated is: http://mail.python.o

Re: Top and Bottom Values [PEP: 326]

2006-09-28 Thread Antoon Pardon
On 2006-09-28, Georg Brandl <[EMAIL PROTECTED]> wrote: > Antoon Pardon wrote: >> On 2006-09-27, OKB (not okblacke) <[EMAIL PROTECTED]> wrote: >>> Antoon Pardon wrote: >>> To begin with this already fails: >>> for i in xrange(Top): ... print i >>> >>> What do you ex

Re: Top and Bottom Values [PEP: 326]

2006-09-28 Thread Georg Brandl
Antoon Pardon wrote: > On 2006-09-27, OKB (not okblacke) <[EMAIL PROTECTED]> wrote: >> Antoon Pardon wrote: >> >>> To begin with this already fails: >>> >> for i in xrange(Top): >>> ... print i >> >> What do you expect this to do? Loop forever? > > Yes that is what I would expect. Fo

Re: Top and Bottom Values [PEP: 326]

2006-09-28 Thread Georg Brandl
Antoon Pardon wrote: > On 2006-09-27, George Sakkis <[EMAIL PROTECTED]> wrote: >> Antoon Pardon wrote: >> >>> What bothers me a bit about the rejection of PEP 326 is that one of the >>> reasons stated is: >>> >>> http://mail.python.org/pipermail/python-dev/2004-January/042306.html >>> >>> - it

Re: Top and Bottom Values [PEP: 326]

2006-09-28 Thread Antoon Pardon
On 2006-09-27, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Wed, 27 Sep 2006 13:37:40 +, Paul McGuire wrote: > >> Here's a little more refined version of my previous post: >> >> class StubbornInt(int): >> def invariantOp(self,other): >> return self >> __add__ = invariantOp >

Re: Top and Bottom Values [PEP: 326]

2006-09-28 Thread Antoon Pardon
On 2006-09-27, Tim Chase <[EMAIL PROTECTED]> wrote: >>> To begin with this already fails: >>> >> for i in xrange(Top): >>> ... print i >> >> What do you expect this to do? Loop forever? > > Perhaps the infinite loop should take half as long as > > >>> for i in xrange(Bottom, Top): prin

Re: Top and Bottom Values [PEP: 326]

2006-09-28 Thread Antoon Pardon
On 2006-09-27, OKB (not okblacke) <[EMAIL PROTECTED]> wrote: > Antoon Pardon wrote: > >> To begin with this already fails: >> > for i in xrange(Top): >> ... print i > > What do you expect this to do? Loop forever? Yes that is what I would expect. If someone would ask me to implement

Re: Top and Bottom Values [PEP: 326]

2006-09-28 Thread Antoon Pardon
On 2006-09-27, George Sakkis <[EMAIL PROTECTED]> wrote: > Antoon Pardon wrote: > >> What bothers me a bit about the rejection of PEP 326 is that one of the >> reasons stated is: >> >> http://mail.python.org/pipermail/python-dev/2004-January/042306.html >> >> - it is easily implemented when you

Re: Top and Bottom Values [PEP: 326]

2006-09-27 Thread Tim Chase
>> To begin with this already fails: >> > for i in xrange(Top): >> ... print i > > What do you expect this to do? Loop forever? Perhaps the infinite loop should take half as long as >>> for i in xrange(Bottom, Top): print i Though then the values when the loop first starts are kin

Re: Top and Bottom Values [PEP: 326]

2006-09-27 Thread OKB (not okblacke)
Antoon Pardon wrote: > To begin with this already fails: > for i in xrange(Top): > ... print i What do you expect this to do? Loop forever? -- --OKB (not okblacke) Brendan Barnwell "Do not follow where the path may lead. Go, instead, where there is no path, and leave a trail."

Re: Top and Bottom Values [PEP: 326]

2006-09-27 Thread George Sakkis
Antoon Pardon wrote: > What bothers me a bit about the rejection of PEP 326 is that one of the > reasons stated is: > > http://mail.python.org/pipermail/python-dev/2004-January/042306.html > > - it is easily implemented when you really need it > > Well I thought it would simplify some things f

Re: Top and Bottom Values [PEP: 326]

2006-09-27 Thread Steven D'Aprano
On Wed, 27 Sep 2006 13:37:40 +, Paul McGuire wrote: > Here's a little more refined version of my previous post: > > class StubbornInt(int): > def invariantOp(self,other): > return self > __add__ = invariantOp > __sub__ = invariantOp [snip rest of code] > import sys > Top

Re: Top and Bottom Values [PEP: 326]

2006-09-27 Thread Antoon Pardon
On 2006-09-27, Paul McGuire <[EMAIL PROTECTED]> wrote: > "Antoon Pardon" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> On 2006-09-27, Peter Otten <[EMAIL PROTECTED]> wrote: >>> Antoon Pardon wrote: >>> I had written my own module, which works similarly but is somewhat

Re: Top and Bottom Values [PEP: 326]

2006-09-27 Thread Sion Arrowsmith
Lawrence D'Oliveiro <[EMAIL PROTECTED]> wrote: >In message <[EMAIL PROTECTED]>, Antoon Pardon wrote: >> I need this Top value in >> a context where it can be used as a start or stop value >> in a slice. >But the only valid values allowed for indices are 0 >>> range(5)[:-1] [0, 1, 2, 3] > up to

Re: Top and Bottom Values [PEP: 326]

2006-09-27 Thread Paul McGuire
"Antoon Pardon" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On 2006-09-27, Peter Otten <[EMAIL PROTECTED]> wrote: >> Antoon Pardon wrote: >> >>> I had written my own module, which works similarly but >>> is somewhat extended. Here is an example of how it can >>> be used and how I

Re: Top and Bottom Values [PEP: 326]

2006-09-27 Thread Paul McGuire
"Antoon Pardon" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On 2006-09-27, Peter Otten <[EMAIL PROTECTED]> wrote: >> Antoon Pardon wrote: >> >>> I had written my own module, which works similarly but >>> is somewhat extended. Here is an example of how it can >>> be used and how I

Re: Top and Bottom Values [PEP: 326]

2006-09-27 Thread Antoon Pardon
On 2006-09-27, Peter Otten <[EMAIL PROTECTED]> wrote: > Antoon Pardon wrote: > >> I had written my own module, which works similarly but >> is somewhat extended. Here is an example of how it can >> be used and how I would like to use it but get stuck. >> >> from extreme import Top > Top >> Top

Re: Top and Bottom Values [PEP: 326]

2006-09-27 Thread Peter Otten
Antoon Pardon wrote: > I had written my own module, which works similarly but > is somewhat extended. Here is an example of how it can > be used and how I would like to use it but get stuck. > > from extreme import Top Top > Top Top + 1 > Top Top - 30 > Top Top > 1e99 > True >

Re: Top and Bottom Values [PEP: 326]

2006-09-27 Thread John Machin
Lawrence D'Oliveiro wrote: > In message <[EMAIL PROTECTED]>, Antoon Pardon wrote: > > > I need this Top value in > > a context where it can be used as a start or stop value > > in a slice. > > But the only valid values allowed for indices are 0 up to the length of the > array inclusive. Larger int

Re: Top and Bottom Values [PEP: 326]

2006-09-27 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Antoon Pardon wrote: > I need this Top value in > a context where it can be used as a start or stop value > in a slice. But the only valid values allowed for indices are 0 up to the length of the array inclusive. Larger integers are not allowed, so why should Top b