Re: list (range) syntax

2007-10-26 Thread Christof Winter
Ryan Ginstrom wrote: >> On Behalf Of Steven D'Aprano >> Because in common English, counting starts at 1 and ranges >> normally include both end points (that is, it is a "closed" >> interval). If you say "I'll be away from the 4th to the 7th" >> and then turn up on the 7th, nearly everyone will w

Re: [0..9] list (range) syntax

2007-10-25 Thread Wildemar Wildenburger
Michal Bozon wrote: > The .. syntax was not meant only as something > which would include the last item, > but also/rather a range list syntactic shortcut: > > [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] --> > [0, 1, ... 9, 10] --> > [0..10] > OK, I see. But I still fail to see where this is useful. All

Re: list (range) syntax

2007-10-24 Thread Carl Banks
On Oct 24, 6:44 pm, Michal Bozon <[EMAIL PROTECTED]> wrote: > many Python newcomers are confused why > range(10), does not include 10. > > If there was a proposal for the new > syntax for ranges, which is known > e.g. from Pascal or Ruby... > > >>> [0..10] > > [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] > >

RE: list (range) syntax

2007-10-24 Thread Ryan Ginstrom
> On Behalf Of Steven D'Aprano > Because in common English, counting starts at 1 and ranges > normally include both end points (that is, it is a "closed" > interval). If you say "I'll be away from the 4th to the 7th" > and then turn up on the 7th, nearly everyone will wonder why > you're back a

Re: list (range) syntax

2007-10-24 Thread Steven D'Aprano
On Wed, 24 Oct 2007 16:28:20 -0700, [EMAIL PROTECTED] wrote: > On Oct 24, 5:44 pm, Michal Bozon <[EMAIL PROTECTED]> wrote: >> many Python newcomers are confused why range(10), does not include 10. > > How can they be confused? Because in common English, counting starts at 1 and ranges normally

Re: [0..9] list (range) syntax

2007-10-24 Thread Michal Bozon
On Thu, 25 Oct 2007 01:16:57 +0200, Wildemar Wildenburger wrote: > Michal Bozon wrote: >> many Python newcomers are confused why >> range(10), does not include 10. >> > It produces a list of ten elements. Also the documentation is quite > clear on the topic. And lastly: This will probably really

Re: list (range) syntax

2007-10-24 Thread [EMAIL PROTECTED]
On Oct 24, 5:44 pm, Michal Bozon <[EMAIL PROTECTED]> wrote: > many Python newcomers are confused why > range(10), does not include 10. How can they be confused? Does base 10 have a digit ten? Does base 2 have a digit two? Does base 16 have a digit sixteen? Haven't you stopped counting on your f

Re: [0..9] list (range) syntax

2007-10-24 Thread Wildemar Wildenburger
Michal Bozon wrote: > many Python newcomers are confused why > range(10), does not include 10. > It produces a list of ten elements. Also the documentation is quite clear on the topic. And lastly: This will probably really bother you for a week, then no more. > If there was a proposal for the

[0..9] list (range) syntax

2007-10-24 Thread Michal Bozon
many Python newcomers are confused why range(10), does not include 10. If there was a proposal for the new syntax for ranges, which is known e.g. from Pascal or Ruby... >>> [0..10] [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] ...is there a chance to be approved ? We have had a short discussion on it at t

Re: range syntax

2006-11-12 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Colin J. Williams <[EMAIL PROTECTED]> wrote: . . . >Your point about iterators is well taken, but it seems that the range is >used sufficiently frequently that some syntactic form would be helpf

Re: range syntax

2006-11-11 Thread Colin J. Williams
Fredrik Lundh wrote: > Colin J. Williams wrote: > >> One of the little irritants of Python is that the range syntax is rather >> long-winded: >> [Dbg]>>> range(3, 20, 6) >> [3, 9, 15] >> [Dbg]>>> >> It would be nice if one could have so

Re: range syntax

2006-11-10 Thread Antoon Pardon
On 2006-11-10, Roberto Bonvallet <[EMAIL PROTECTED]> wrote: > Colin J. Williams wrote: >> One of the little irritants of Python is that the range syntax is rather >> long-winded: >> [Dbg]>>> range(3, 20, 6) >> [3, 9, 15] >> [Dbg]>>> &g

Re: range syntax

2006-11-10 Thread Fredrik Lundh
Colin J. Williams wrote: > One of the little irritants of Python is that the range syntax is rather > long-winded: > [Dbg]>>> range(3, 20, 6) > [3, 9, 15] > [Dbg]>>> > It would be nice if one could have something like 3:20:6. if you find yourself using range

Re: range syntax

2006-11-10 Thread Roberto Bonvallet
Colin J. Williams wrote: > One of the little irritants of Python is that the range syntax is rather > long-winded: > [Dbg]>>> range(3, 20, 6) > [3, 9, 15] > [Dbg]>>> > It would be nice if one could have something like 3:20:6. In that case, how would the pa

range syntax

2006-11-10 Thread Colin J. Williams
One of the little irritants of Python is that the range syntax is rather long-winded: [Dbg]>>> range(3, 20, 6) [3, 9, 15] [Dbg]>>> It would be nice if one could have something like 3:20:6. I've just come across the r_class in numpy which doesn't go that far but does