Minor Ones
Explore subtle Python behaviors including the string-based join method, valid but unusual statements, the difference in increment operators compared to other languages, and unique operators like the space-invader and undocumented converse implication. Understand these quirks to write clearer and more Pythonic code.
We'll cover the following...
We'll cover the following...
1.
The join() method is a string operation instead of a list operation, though it might seem counter-intuitive at first usage.
Explanation
If join() is a method on a string, then it can operate on any iterable (list, tuple, iterators). If it were a method on a list, it’d have to be implemented separately by every type. Also, it doesn’t make much sense to put a string-specific method on a generic list object API.
Here are a few weird looking ...