Vitalik Buterin pfp
Vitalik Buterin
@vitalik.eth
"continue" might be the worst-named keyword in python. Like, consider this code: for i in range(100): if i % 5 == 0: continue print(i) It prints out numbers that are not multiples of 5. But if you give it to someone who is not experienced in python, they might think the exact opposite!
37 replies
80 recasts
469 reactions

Mark V. pfp
Mark V.
@mikroskeem
If Python has it wrong, then other languages have it too - that being said, it's great that Python does not diverge too much with keywords from most commonly used languages.
1 reply
0 recast
3 reactions

Nico pfp
Nico
@nicom
Well just revert the condition then, why make things complicated? for i in range(100): if i % 5 != 0: print(i)
2 replies
0 recast
7 reactions

links 🏴 pfp
links 🏴
@links
Honestly never thought about it like that. It’s a common keyword in a ton of languages: C/C++, Java, JS, PHP, etc. Does python handle it differently than other languages? Seems like they all treat it the same.
0 reply
0 recast
4 reactions

karmacoma pfp
karmacoma
@karma
feels pretty natural when you come from C/Java/other imperative language
0 reply
0 recast
1 reaction

Suhail Kakar pfp
Suhail Kakar
@suhailkakar
also, `except` try: some_function() except SomeError as err: some_handle(err) why isn't it called catch like literally everywhere else in humanity?
0 reply
0 recast
1 reaction

Patrick Atwater | 🌱🚴3🌐 pfp
Patrick Atwater | 🌱🚴3🌐
@patwater
Hard disagree This is actually pretty plain language from the perspective of formal logic The standard isn't lay person English or any lay language Python is amazing at being intuitive for the mathematically inclined That's the one trained in pencil and paper math this makes total sense And it's something that makes sense with a simple addition of tabbing
0 reply
0 recast
0 reaction

Garrett pfp
Garrett
@garrett
moose
0 reply
0 recast
0 reaction

Nicki Sanders pfp
Nicki Sanders
@nicki
That is confusing!
0 reply
0 recast
0 reaction

Mirko 🔵🟡 .⌐◨-◨ pfp
Mirko 🔵🟡 .⌐◨-◨
@netnose
I think break, continue and goto are the biggest code smell ever. I always ask to remove them if possible during reviews!
1 reply
0 recast
3 reactions

Tempe Techie pfp
Tempe Techie
@tempetechie.eth
What would be better? "skip", "ignore", "next"?
1 reply
0 recast
2 reactions

⋆♱ 9̷0̷†մղ ♱⋆ pfp
⋆♱ 9̷0̷†մղ ♱⋆
@90tun
what then should be used, skip?
2 replies
0 recast
2 reactions

joshisdead.eth pfp
joshisdead.eth
@joshisdead.eth
$moose might chew this
0 reply
0 recast
2 reactions

Fots pfp
Fots
@fots
i believe it is natural, because it intuitively means to continue the loop - just skipping the rest of the current iteration. once you understand that the loop itself keeps running, the keyword makes perfect sense
0 reply
0 recast
1 reaction

Rafi pfp
Rafi
@0xrafi
Can devs do something
0 reply
0 recast
0 reaction

abranti pfp
abranti
@abranti
what would you name it?
0 reply
0 recast
0 reaction

beenaid.RVV Orochi KGeN pfp
beenaid.RVV Orochi KGeN
@beenaid
👀
0 reply
0 recast
0 reaction

Mrnv pfp
Mrnv
@mrnv
The word "continue" can be really confusing, especially for beginners. It seems logical to expect that when continue is triggered, the code will continue executing the remaining instructions inside the loop, rather than jumping over them.
0 reply
0 recast
0 reaction

OPi pfp
OPi
@opimedia
When the keyword it taken in this wrong meaning… that makes no sense. Because that makes no senses to put a keyword to continue to the next line. This is the usual execution path. So, even for not experienced (whatever Python or not), it is a big hint that the meaning of this keyword is something else.
0 reply
0 recast
0 reaction

Irect341 pfp
Irect341
@irect341
Hey Vitalik! Spot - on observation about the "continue" keyword in Python. Your example really drives home how its name can be misleading for those new to the language. It's one of those quirks that makes Python both interesting and a bit of a head - scratcher at times. Thanks for sharing this thought - provoking take. It'll definitely make developers think twice when using that keyword!
0 reply
0 recast
0 reaction