[Python-ideas] PEP 572: Statement-Local Name Bindings, take three!

Guido van Rossum guido at python.org
Mon Apr 2 18:03:31 EDT 2018


IIRC Algol-68 (the lesser-known, more complicated version) used 'int x =
0;' to declare a constant and 'int x := 0;' to declare a variable. And
there was a lot more to it; see
https://en.wikipedia.org/wiki/ALGOL_68#mode:_Declarations. I'm guessing Go
reversed this because they want '=' to be the common assignment (whereas in
Algol-68 the common assignment was ':=').

My current thinking about Python is that if we're doing this, '=' and ':='
will mean the same thing but inside an expression you must use ':='. Chris,
Nick and I are working out some details off-list.

On Mon, Apr 2, 2018 at 1:51 PM, Mike Miller <python-ideas at mgmiller.net>
wrote:

> Yes, I first came across := when learning (Turbo) Pascal in the early 90's.
>
> However golang managed to screw it up—it only works there as a "short
> declaration AND assignment" operator.  You can't use it twice on the same
> variable!  Boggles the mind how experienced designers came up with that
> one. ;-)  Maybe Algol did it that way?  (before my time)
>
> I found Pascal's syntax, := for assignment, = and <>, for tests about
> close to perfect in ease of learning/comprehension as it gets, from someone
> who studied math before C anyway.
>
> -Mike
>
>
>
> On 2018-03-30 12:04, Nikolaus Rath wrote:
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>



-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180402/2f93f584/attachment.html>


More information about the Python-ideas mailing list