Re: extend for loop syntax with if expr like listcompgenexp ?

2005-07-14 Thread Paul Rubin
Terry Hancock [EMAIL PROTECTED] writes: But of course that's not equivalent. It's hard to imagine a use case for an enumerated loop when the object being iterated over is anonymous (will be lost as soon as the loop exits). Huh? Not at all. print 'List of Python fans:' for i,x in

Re: extend for loop syntax with if expr like listcompgenexp ?

2005-07-12 Thread Terry Hancock
On Monday 11 July 2005 08:53 pm, Bengt Richter wrote: On Tue, 12 Jul 2005 10:12:33 +1000, John Machin [EMAIL PROTECTED] wrote: Bengt Richter wrote: for x in (x for x in seq if x is not None): Byzantine ... Perhaps not if you wanted to enumerate the selected elements, as in for i,

Re: extend for loop syntax with if expr like listcompgenexp ?

2005-07-12 Thread Bengt Richter
On Tue, 12 Jul 2005 23:07:07 -0500, Terry Hancock [EMAIL PROTECTED] wrote: On Monday 11 July 2005 08:53 pm, Bengt Richter wrote: On Tue, 12 Jul 2005 10:12:33 +1000, John Machin [EMAIL PROTECTED] wrote: Bengt Richter wrote: for x in (x for x in seq if x is not None): Byzantine ...

extend for loop syntax with if expr like listcompgenexp ?

2005-07-11 Thread Bengt Richter
E.g., so we could write for x in seq if x is not None: print repr(x), isn't None ;-) instead of for x in (x for x in seq if x is not None): print repr(x), isn't None ;-) just a thought. Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: extend for loop syntax with if expr like listcompgenexp ?

2005-07-11 Thread John Machin
Bengt Richter wrote: E.g., so we could write for x in seq if x is not None: Chundrous; looks like that p**l language ... print repr(x), isn't None ;-) instead of for x in (x for x in seq if x is not None): Byzantine ... print repr(x), isn't None ;-) just

Re: extend for loop syntax with if expr like listcompgenexp ?

2005-07-11 Thread Ron Adam
Bengt Richter wrote: E.g., so we could write for x in seq if x is not None: print repr(x), isn't None ;-) instead of for x in (x for x in seq if x is not None): print repr(x), isn't None ;-) just a thought. Regards, Bengt Richter Is it new idea month?

Re: extend for loop syntax with if expr like listcompgenexp ?

2005-07-11 Thread Bengt Richter
On Tue, 12 Jul 2005 10:12:33 +1000, John Machin [EMAIL PROTECTED] wrote: Bengt Richter wrote: E.g., so we could write for x in seq if x is not None: Chundrous; looks like that p**l language ... ^--piqued my interest, where'd that come from? ;-) print repr(x), isn't