Re: auto increment

2011-03-04 Thread BartC
"Chris Rebert" wrote in message news:mailman.596.1299215244.1189.python-l...@python.org... On Thu, Mar 3, 2011 at 9:05 PM, Dan Stromberg wrote: On Thu, Mar 3, 2011 at 8:48 PM, Chris Rebert wrote: On Thu, Mar 3, 2011 at 8:41 PM, monkeys paw wrote: > Does python have an analogy to c/perl i

Re: auto increment

2011-03-04 Thread monkeys paw
On 3/4/2011 12:07 AM, Chris Rebert wrote: On Thu, Mar 3, 2011 at 9:05 PM, Dan Stromberg wrote: On Thu, Mar 3, 2011 at 8:48 PM, Chris Rebert wrote: On Thu, Mar 3, 2011 at 8:41 PM, monkeys paw wrote: Does python have an analogy to c/perl incrementer? e.g. i = 0 i++ i += 1 If you're doing

Re: auto increment

2011-03-03 Thread Dan Stromberg
On Thu, Mar 3, 2011 at 9:07 PM, Chris Rebert wrote: > On Thu, Mar 3, 2011 at 9:05 PM, Dan Stromberg wrote: > > On Thu, Mar 3, 2011 at 8:48 PM, Chris Rebert wrote: > >> On Thu, Mar 3, 2011 at 8:41 PM, monkeys paw > wrote: > >> > Does python have an analogy to c/perl incrementer? > >> > > >> > e

Re: auto increment

2011-03-03 Thread Chris Rebert
On Thu, Mar 3, 2011 at 9:05 PM, Dan Stromberg wrote: > On Thu, Mar 3, 2011 at 8:48 PM, Chris Rebert wrote: >> On Thu, Mar 3, 2011 at 8:41 PM, monkeys paw wrote: >> > Does python have an analogy to c/perl incrementer? >> > >> > e.g. >> > >> > i = 0 >> > i++ >> >> i += 1 >> >> If you're doing this

Re: auto increment

2011-03-03 Thread Dan Stromberg
On Thu, Mar 3, 2011 at 8:48 PM, Chris Rebert wrote: > On Thu, Mar 3, 2011 at 8:41 PM, monkeys paw wrote: > > Does python have an analogy to c/perl incrementer? > > > > e.g. > > > > i = 0 > > i++ > > i += 1 > > If you're doing this for a list index, use enumerate() instead. > There's been discus

Re: auto increment

2011-03-03 Thread Chris Rebert
On Thu, Mar 3, 2011 at 8:41 PM, monkeys paw wrote: > Does python have an analogy to c/perl incrementer? > > e.g. > > i = 0 > i++ i += 1 If you're doing this for a list index, use enumerate() instead. Regards, Chris -- http://mail.python.org/mailman/listinfo/python-list

auto increment

2011-03-03 Thread monkeys paw
Does python have an analogy to c/perl incrementer? e.g. i = 0 i++ Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: auto-increment operator - why no syntax error?

2007-12-08 Thread Steve Howell
--- Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Sat, 08 Dec 2007 16:58:25 -0800, Karthik Gurusamy > wrote: > > > Why are the following accepted even without a > warning about syntax > > error? > > (I would expect the python grammar should catch > these kind of syntax > > errors) > >

Re: auto-increment operator - why no syntax error?

2007-12-08 Thread Marc 'BlackJack' Rintsch
On Sat, 08 Dec 2007 16:58:25 -0800, Karthik Gurusamy wrote: > Why are the following accepted even without a warning about syntax > error? > (I would expect the python grammar should catch these kind of syntax > errors) > n = 1 2 * + n > 2 n += 1 n > 2 ++n > 2 There i

Re: auto-increment operator - why no syntax error?

2007-12-08 Thread Chris M
On Dec 8, 7:58 pm, Karthik Gurusamy <[EMAIL PROTECTED]> wrote: > I see python doesn't have ++ or -- operators unlike say, C. > I read some reasonings talking about immutable scalars and using ++/-- > doesn't make much sense in python (not sure if ++i is that far-fetched > compared to the allowed i

auto-increment operator - why no syntax error?

2007-12-08 Thread Karthik Gurusamy
I see python doesn't have ++ or -- operators unlike say, C. I read some reasonings talking about immutable scalars and using ++/-- doesn't make much sense in python (not sure if ++i is that far-fetched compared to the allowed i += 1) In any case, I accidentally wrote ++n in python and it silently