>>11There is nothing wrong with using None for absence of value, since this is literally what it stands for. As far as I understand,
None
maps closely to
NIL
in something like Common Lisp, where it can stand either for false, or nothing [assume default] (for example, end arguments to
STRING=
).
I do agree that it looks ugly, but in practice, you would not write it this way; I wrote it explicitly to explain what is really going on. In practice, you would conditionally assign None or an integer to a variable, and use the variable as an index:
xs = [1, 2, 3, 4, 5, 6, 7]
a = 0
xs[:a:-1] -> [7, 6, 5, 4, 3, 2]
a = None
xs[:a:-1] -> [7, 6, 5, 4, 3, 2, 1]
I'm also not a fan of python, but I think this is a minor wart compared to the tower of crap it's built on. To name a few turds:
- The entire python2 to python3 migration circus
- Changes breaking backward compatibility between versions in general
- FIOC
- Program refuses to run if you mix tabs and spaces
- Explicit self, and poorly designed OOP in general
- Lack of goto by design
It can't decide between being a language for quick and dirty scripting, and a language for serious programming, and it ends up crippling it on both fronts.
I do understand where you are coming from with this though. Pile up enough minor, unintuitive annoyances like that, and van Possum might end up dying in a horrible fashion, at the hands of somebody who's had enough, before Python4 is released.