cosmologicon / pywat

Python wats
1.22k stars 99 forks source link

while - else #34

Open adamjezek98 opened 7 years ago

adamjezek98 commented 7 years ago

This is also kinda wat. Else is always executed, unless you break it https://pastebin.com/HHMRpcQw

tgandor commented 5 years ago

There is also for ... else for that matter.

But unfortunatelly, it's just an obscure idiom - a good question for a job interview in Python. Not really a WAT. Raymond Hettinger also complained about the keyword choice - why reuse else, and not introduce a new one, like nobreak:.

I think it's pretty well known in the "Pythonic" sphere, just like try ... else.