4 ms·
The magic methods in Python are used to support common, built-in functionality. E.g., `__init__` is the constructor (you rarely need `__new__`), `__len__` suppo
by cpburns2009 10y ago
The magic methods in Python are used to support common, built-in functionality. E.g., `__init__` is the constructor (you rarely need `__new__`), `__len__` supports the standard `len()` function, `__str__` is equivalent to JavaScript's `.toString()`, etc.
Signification white-space should actually help students when programming because it forces code to be properly indented instead of having an indentation disaster or misplaced braces.
One-line lambdas and decorator functions are no worse than JavaScript's.
The tuple syntax is clunky, but there is an important distinction between it and lists: mutability of the list itself.
Frankly no one should be using `global` without a very good reason.
The split between 2 and 3 is hardly worth mentioning. 2 is the legacy version. 3 is actively maintained and most major libraries have supported 3 for a while. Very little changed syntax wise between them. The split was necessary because of a fundamental improvement and disambiguation between textual and binary strings.