code review

Duncan Booth duncan.booth at invalid.invalid
Mon Jul 16 06:43:50 EDT 2012


Steven D'Aprano <steve+comp.lang.python at pearwood.info> wrote:

> On Fri, 13 Jul 2012 12:30:47 +0000, Albert van der Horst wrote:
>> The worst of is, of course, = for assignment instead of := . This is
>> a convention that Python follows, to my dismay.
> 
> *shrug*
> 
> The worst is to use = for both equality and assignment, like some
> BASICs. At least Python does not allow assignment as an expression, so
> you can't make the typical C error of:
> 
> if x = y: do_something()  # oops meant x == y
> 
Technically of course Python doesn't have assignment, it just binds names.

Albert raised the subject of Algol 68 which if I remember correctly used := 
for assignment and = to bind names (although unlike Python you couldn't 
then re-bind the name to another object in the same scope).


-- 
Duncan Booth http://kupuguy.blogspot.com



More information about the Python-list mailing list