Comments on The Bad and Good of Python

2 Comments.

Python does indeed let you exit a loop early, with break (just like in C-family languages):

for i in range(500):
  print i
  if i > 2: break

Also, range iterator objects are pretty lightweight.

I dislike the whitespace-tokenization mostly because now I’m not sure if the code I wrote above is going to be formatted reasonably for this comment system.

My big complaint with Python is the lack of an increment or decrement operator. In Python, both ++i and –i are perfectly valid code – that do absolutely nothing. (–x parses as -(-x), and unary + is a no-op that they maintained for symmetry with -.)

-- fluffy 2017-09-22 06:33 UTC


That’s not what I meant. Python signals the normal end of a loop with an exception, internally. How exactly is the fact that a loop ends… unexpected?

-- Felix 2017-09-22 06:33 UTC