[Python-ideas] allow `lambda' to be spelled λ
Ben Finney
ben+python at benfinney.id.au
Wed Jul 13 01:52:13 EDT 2016
Pavol Lisy <pavol.lisy at gmail.com> writes:
> Questions around "only one possibilities how to write it" could be
> probably answered with this?
>
> a<b
> a.__lt__(b)
The maxim is not “only one way”. That is a common misconception, but it
is easily dispelled: read the Zen of Python (by ‘import this’ in the
interactive prompt).
Rather, the maxim is “There should be one obvious way to do it”, with a
parenthetical “and preferably only one”.
So the emphasis is on the way being *obvious*, and all other ways being
non-obvious. This leads, of course, to choosing the best way to also be
the one obvious way to do it.
Your example above supports this: the comparison ‘a < b’ is the one
obvious way to compare whether ‘a’ is less than ‘b’.
--
\ “It is forbidden to steal hotel towels. Please if you are not |
`\ person to do such is please not to read notice.” —hotel, |
_o__) Kowloon, Hong Kong |
Ben Finney
More information about the Python-ideas
mailing list