we’re mostly fixing well-known annoyances and warts, and removing a lot of old cruft
It mentions what is different (the fix) but not why (the problems). I have have not found what were the problems. What were the problems the fixes solve?
Software Engineering Stack Exchange is a question and answer site for professionals, academics, and students working within the systems development life cycle. It only takes a minute to sign up.
Sign up to join this communitywe’re mostly fixing well-known annoyances and warts, and removing a lot of old cruft
It mentions what is different (the fix) but not why (the problems). I have have not found what were the problems. What were the problems the fixes solve?
I'll just name the ones that come to mind immediately.
nonlocal
: Without this, closures can't overwrite variables closed over. This need arises from time to time with decorators and other higher-order functions. The only reasonable workaround (without switching the external API), storing whatever mutable state you want in a mutable object, is excessively ugly.in
tests (as of Python 3.2, these are also optimized by the peephole optimizer).0777
notation is a pitfall for those not used to it (in other contexts, adding a leading zero changes neither value nor base).except ex, var
-> except ex as var
fixes the common error except ValueError, IndexError
(ought to catch both, but only catches the first and overwrites the name IndexError
with the caught exception).