[Python-ideas] PEP 572: Statement-Local Name Bindings, take three!
rosuav at gmail.com
Tue Apr 10 23:57:18 EDT 2018
On Wed, Apr 11, 2018 at 1:15 PM, Mike Miller <python-ideas at mgmiller.net> wrote:
> If anyone is interested I came across this same subject on a blog post and
> discussion on HN today:
> - https://www.hillelwayne.com/post/equals-as-assignment/
> - https://news.ycombinator.com/item?id=16803874
Those people who say "x = x + 1" makes no sense... do they also get
confused by the fact that you can multiply a string by a number?
Programming is not algebra. The ONLY reason that "x = x + 1" can fail
to make sense is if you start by assuming that there is no such thing
as time. That's the case in algebra, but it simply isn't true in
software. Functional programming languages are closer to algebra than
imperative languages are, but that doesn't mean they _are_ algebraic,
and they go to great lengths to lie about how you can have
side-effect-free side effects and such.
Fortunately, Python is not bound by such silly rules, and can do
things because they are useful for real-world work. Thus the question
of ":=" vs "=" vs "==" vs "===" comes down to what is actually worth
doing, not what would look tidiest to someone who is trying to
represent a mathematician's blackboard in ASCII.
More information about the Python-ideas