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 Strombergdrsali...@gmail.com wrote: On Thu, Mar 3, 2011 at 8:48 PM, Chris Rebertc...@rebertia.com wrote: On Thu, Mar 3, 2011 at 8:41 PM, monkeys pawmon...@joemoney.net wrote: Does python have an analogy to c/perl

Re: auto increment

2011-03-04 Thread BartC
Chris Rebert c...@rebertia.com wrote in message news:mailman.596.1299215244.1189.python-l...@python.org... On Thu, Mar 3, 2011 at 9:05 PM, Dan Stromberg drsali...@gmail.com wrote: On Thu, Mar 3, 2011 at 8:48 PM, Chris Rebert c...@rebertia.com wrote: On Thu, Mar 3, 2011 at 8:41 PM, monkeys

Re: auto increment

2011-03-03 Thread Chris Rebert
On Thu, Mar 3, 2011 at 8:41 PM, monkeys paw mon...@joemoney.net 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

Re: auto increment

2011-03-03 Thread Dan Stromberg
On Thu, Mar 3, 2011 at 8:48 PM, Chris Rebert c...@rebertia.com wrote: On Thu, Mar 3, 2011 at 8:41 PM, monkeys paw mon...@joemoney.net 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.

Re: auto increment

2011-03-03 Thread Chris Rebert
On Thu, Mar 3, 2011 at 9:05 PM, Dan Stromberg drsali...@gmail.com wrote: On Thu, Mar 3, 2011 at 8:48 PM, Chris Rebert c...@rebertia.com wrote: On Thu, Mar 3, 2011 at 8:41 PM, monkeys paw mon...@joemoney.net wrote: Does python have an analogy to c/perl incrementer? e.g. i = 0 i++ i

Re: auto increment

2011-03-03 Thread Dan Stromberg
On Thu, Mar 3, 2011 at 9:07 PM, Chris Rebert c...@rebertia.com wrote: On Thu, Mar 3, 2011 at 9:05 PM, Dan Stromberg drsali...@gmail.com wrote: On Thu, Mar 3, 2011 at 8:48 PM, Chris Rebert c...@rebertia.com wrote: On Thu, Mar 3, 2011 at 8:41 PM, monkeys paw mon...@joemoney.net wrote: Does

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 += 1)

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 is no syntax error. It is

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) 2 * + n