Re: adding elif to for

2017-12-19 Thread Skip Montanaro
Has any thought been given to adding elif to the for statement?


Time machine at work I think:

https://docs.python.org/3/reference/compound_stmts.html#the-if-statement

Skip
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: adding elif to for

2017-12-19 Thread Skip Montanaro
Apologies. Misread your question.

Skip

On Dec 19, 2017 6:16 PM, "Skip Montanaro"  wrote:

>
> Has any thought been given to adding elif to the for statement?
>
>
> Time machine at work I think:
>
> https://docs.python.org/3/reference/compound_stmts.html#the-if-statement
>
> Skip
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: adding elif to for

2017-12-19 Thread Bill

bob gailer wrote:

Has any thought been given to adding elif to the for statement?


I don't think it is a good idea because it needlessly, from my point of 
view, embeds too much complexity into a single construct (making it more 
difficult to maintain, for instance). That's what language designer's do 
though--they kick ideas like that around.  If you have a great idea, 
maybe propose a new language.




for x in foo:
if y: break
elif a==b:
something
else:
something else

as a shortcut to:
for x in foo:
if y: break
else:
if a==b:
something
else:
something else
bob gailer


--
https://mail.python.org/mailman/listinfo/python-list


adding elif to for

2017-12-19 Thread bob gailer

Has any thought been given to adding elif to the for statement?

for x in foo:
    if y: break
elif a==b:
    something
else:
    something else

as a shortcut to:
for x in foo:
    if y: break
else:
    if a==b:
    something
else:
    something else
bob gailer
--
https://mail.python.org/mailman/listinfo/python-list