Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #110538

Re: Assignment Versus Equality

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Christopher Reimer <christopher_reimer@icloud.com>
Newsgroups comp.lang.python
Subject Re: Assignment Versus Equality
Date Sun, 26 Jun 2016 11:47:25 -0700
Lines 68
Message-ID <mailman.12.1466970454.2358.python-list@python.org> (permalink)
References <8a53c069-ca13-47bf-a24e-d2393a018b22@googlegroups.com> <nkobtu$gaq$1@dont-email.me> <576fd6e0$0$1617$c3e8da3$5496439d@news.astraweb.com> <2588c5b2-4b6f-cfbb-f91e-4db03aa50318@icloud.com>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 8bit
X-Trace news.uni-berlin.de RTKiGrG1920E0CDmJgsGzQqNKLaR4+Pyic+CqjLJ64kg==
Return-Path <christopher_reimer@icloud.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.008
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; '(of': 0.07; 'assignment': 0.07; 'ambiguity': 0.09; 'beginners': 0.09; 'confuse': 0.09; 'snippet': 0.09; 'python': 0.10; 'python.': 0.11; 'language,': 0.11; 'interpreter': 0.15; '"="': 0.16; '*almost*': 0.16; '2016': 0.16; 'assignment.': 0.16; 'begging': 0.16; 'commercially': 0.16; 'comparison.': 0.16; 'compilers': 0.16; 'equality.': 0.16; 'expressions.': 0.16; 'ops': 0.16; 'personally,': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'obviously': 0.16; "wouldn't": 0.16; 'copied': 0.18; 'numerical': 0.18; 'tree': 0.18; '>>>': 0.20; 'lawrence': 0.22; 'pascal': 0.22; 'programming': 0.22; 'am,': 0.23; 'bit': 0.23; 'absolute': 0.23; "haven't": 0.24; 'second': 0.24; 'header:User-Agent:1': 0.26; 'appear': 0.26; 'chris': 0.26; 'coding': 0.27; 'gnu': 0.27; 'mathematical': 0.27; 'received:17': 0.27; 'regular': 0.29; '(it': 0.29; 'closer': 0.29; 'context,': 0.29; 'equality': 0.29; 'operators': 0.29; 'ronald': 0.29; 'code:': 0.29; "i'm": 0.30; 'print': 0.30; '(including': 0.30; 'certainly': 0.30; 'convention': 0.30; "i'd": 0.31; 'rules': 0.31; "can't": 0.32; 'received:10.0.0': 0.32; 'good.': 0.32; 'language.': 0.32; 'getting': 0.33; "d'aprano": 0.33; 'steven': 0.33; 'languages': 0.34; 'structure': 0.34; 'received:10.0': 0.34; 'next': 0.35; 'could': 0.35; 'community': 0.36; 'but': 0.36; 'should': 0.36; 'there': 0.36; 'basic': 0.36; 'success.': 0.36; 'to:addr:python- list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'agree': 0.37; 'version': 0.38; 'why': 0.39; 'sure': 0.39; 'enough': 0.39; 'well.': 0.40; 'to:addr:python.org': 0.40; 'where': 0.40; 'mark': 0.40; 'still': 0.40; 'header:MIME- version:1': 0.60; 'skip:u 10': 0.61; 'more': 0.63; 'different': 0.63; 'complete': 0.63; 'face': 0.64; 'between': 0.65; 'experience.': 0.66; 'virtually': 0.66; 'here': 0.66; 'repeat': 0.67; 'experts': 0.70; 'feeling': 0.72; 'commercial': 0.73; 'computing.': 0.84; 'confusion.': 0.84; 'delphi': 0.84; 'dialect': 0.84; 'header:In-reply-to:1': 0.84; 'loses': 0.84; 'mistakes.': 0.84; 'tell:': 0.84; 'world!"': 0.84; 'mistakes': 0.95
X-Proofpoint-Virus-Version vendor=fsecure engine=2.50.10432:,, definitions=2016-06-26_10:,, signatures=0
X-Proofpoint-Spam-Details rule=notspam policy=default score=0 spamscore=0 clxscore=1015 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1510270003 definitions=main-1606260210
User-Agent Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1
In-reply-to <576fd6e0$0$1617$c3e8da3$5496439d@news.astraweb.com>
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=4d515a; t=1466966844; bh=arI/GK/OZWN2eX+MgV0t0WesOaF4lQD2GzqOLqwdgUo=; h=Subject:To:From:Message-id:Date:MIME-version:Content-type; b=ppfB6Byb3WIKv4jT89TAaIW9P+KrhUGzCHyCjvhx2/1/fHGDpsVb/89Zjb3q9uUoe 38LTsLVY7A2hANLmoEM+UxkqJs2b9rXF04N4TLIqIQ7vAK8YNNy+w2bssAvmDepHu/ lrjMzRJKtpwksxEm3edffzDn/y0le6VOO2hgQhONyHBfX81HL3a+MKLfhiIugqWEY3 fhf7++pps574yy4Te0Lw32yTchM8guXJnpZSUufdoiLWWfB4rLcqdm5SQzoPm9LCyS V0jp1nxJVjrBZAzLf8QqhSsfKVCCqYBkBIt5CqvplgGyKsNh2kwd2IjcUTUEf1u5yu eXwAUb2940h7w==
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.22
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID <2588c5b2-4b6f-cfbb-f91e-4db03aa50318@icloud.com>
X-Mailman-Original-References <8a53c069-ca13-47bf-a24e-d2393a018b22@googlegroups.com> <nkobtu$gaq$1@dont-email.me> <576fd6e0$0$1617$c3e8da3$5496439d@news.astraweb.com>
Xref csiph.com comp.lang.python:110538

Show key headers only | View raw


On 6/26/2016 6:21 AM, Steven D'Aprano wrote:

> On Sun, 26 Jun 2016 08:48 pm, BartC wrote:
>
>> On 26/06/2016 08:36, Lawrence D’Oliveiro wrote:
>>> One of Python’s few mistakes was that it copied the C convention of using
>>> “=” for assignment and “==” for equality comparison.
>> One of C's many mistakes. Unfortunately C has been very influential.
>>
>> However, why couldn't Python have used "=" both for assignment, and for
>> equality? Since I understand assignment ops can't appear in expressions.
> Personally, I think that even if there is no *syntactical* ambiguity between
> assignment and equality, programming languages should still use different
> operators for them. I must admit that my first love is still Pascal's :=
> for assignment and = for equality, but C's = for assignment and == for
> equality it *almost* as good.
>
> (It loses a mark because absolute beginners confuse the assignment = for the
> = in mathematics, which is just different enough to cause confusion.)
>
> But the BASIC style = for both assignment and equality is just begging for
> confusion. Even though = is not ambiguous given BASIC's rules, it can still
> be ambiguous to beginners who haven't yet digested those rules and made
> them second nature.
>
> And even experts don't always work with complete statements. Here is a
> snippet of BASIC code:
>
> X = Y
>
> Is it an assignment or an equality comparison? Without seeing the context,
> it is impossible to tell:
>
> 10 X = Y + 1
> 20 IF X = Y GOTO 50
>
>
> Now obviously BASIC was a very popular and successful language, for many
> years, despite that flaw. But I wouldn't repeat it in a new language.
>
>
>>> It should have copied the old convention from Algol-like languages
>>> (including Pascal), where “:=” was assignment, so “=” could keep a
>>> meaning closer to its mathematical usage.
>> (I think Fortran and PL/I also used "=" for assignment. Both were more
>> commercially successful than Algol or Pascal.)
> Fortran 77 used .EQ. for equality. I'm not sure about PL/I.
>
> I'm also not sure I'd agree about the commercial success. Fortran certainly
> has been extremely popular, albeit almost entirely in numerical computing.
> But PL/I has virtually disappeared from the face of the earth, while Pascal
> still has a small but dedicated community based on FreePascal, GNU Pascal,
> and Delphi.
>
> (Of the three, FreePascal and Delphi appear to still be getting regular
> releases.)

I started writing a BASIC interpreter in Python. The rudimentary version 
for 10 PRINT "HELLO, WORLD!" and 20 GOTO 10 ran well. The next version 
to read each line into a tree structure left me feeling over my head. So 
I got "Writing Compilers & Interpreters: An Applied Approach" by Ronald 
Mak (1991 edition) from Amazon, which uses C for coding and Pascal as 
the target language.  I know a little bit of C and nothing of Pascal. 
Translating an old dialect of C into modern C, learning Pascal and 
figuring out the vagaries of BASIC should make for an interesting 
learning experience.

Chris R.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Assignment Versus Equality Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-06-26 00:36 -0700
  Re: Assignment Versus Equality BartC <bc@freeuk.com> - 2016-06-26 11:48 +0100
    Re: Assignment Versus Equality Steven D'Aprano <steve@pearwood.info> - 2016-06-26 23:21 +1000
      Re: Assignment Versus Equality Rustom Mody <rustompmody@gmail.com> - 2016-06-26 07:26 -0700
        Re: Assignment Versus Equality Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2016-06-26 11:31 -0400
      Re: Assignment Versus Equality Christopher Reimer <christopher_reimer@icloud.com> - 2016-06-26 11:47 -0700
      Re: Assignment Versus Equality Michael Torrie <torriem@gmail.com> - 2016-06-26 15:28 -0600
      Re: Assignment Versus Equality Bob Gailer <bgailer@gmail.com> - 2016-06-27 08:22 -0400
        Re: Assignment Versus Equality Rustom Mody <rustompmody@gmail.com> - 2016-06-27 05:48 -0700
          Re: Assignment Versus Equality Steven D'Aprano <steve@pearwood.info> - 2016-06-27 23:28 +1000
            Re: Assignment Versus Equality Marko Rauhamaa <marko@pacujo.net> - 2016-06-27 16:58 +0300
            Re: Assignment Versus Equality Rustom Mody <rustompmody@gmail.com> - 2016-06-27 07:23 -0700
              Re: Assignment Versus Equality Steven D'Aprano <steve@pearwood.info> - 2016-06-28 11:05 +1000
                Re: Assignment Versus Equality Rustom Mody <rustompmody@gmail.com> - 2016-06-27 21:31 -0700
                Re: Assignment Versus Equality Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2016-06-28 15:42 +1000
                Re: Assignment Versus Equality Chris Angelico <rosuav@gmail.com> - 2016-06-28 16:04 +1000
                Re: Assignment Versus Equality Marko Rauhamaa <marko@pacujo.net> - 2016-06-28 09:12 +0300
                Re: Assignment Versus Equality Jussi Piitulainen <jussi.piitulainen@helsinki.fi> - 2016-06-28 11:04 +0300
                Re: Assignment Versus Equality Rustom Mody <rustompmody@gmail.com> - 2016-06-27 23:09 -0700
                Re: Assignment Versus Equality Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-06-28 00:12 -0700
                Re: Assignment Versus Equality Chris Angelico <rosuav@gmail.com> - 2016-06-28 17:26 +1000
                Re: Assignment Versus Equality Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-06-28 01:49 -0700
                Re: Assignment Versus Equality Chris Angelico <rosuav@gmail.com> - 2016-06-28 20:34 +1000
                Re: Assignment Versus Equality Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-06-28 17:42 -0700
                Re: Assignment Versus Equality Random832 <random832@fastmail.com> - 2016-06-28 10:13 -0400
                Re: Assignment Versus Equality Marko Rauhamaa <marko@pacujo.net> - 2016-06-28 19:39 +0300
                Re: Assignment Versus Equality Marko Rauhamaa <marko@pacujo.net> - 2016-06-28 19:41 +0300
                Re: Assignment Versus Equality Random832 <random832@fastmail.com> - 2016-06-28 13:19 -0400
                Re: Assignment Versus Equality Ian Kelly <ian.g.kelly@gmail.com> - 2016-06-28 12:27 -0600
                Re: Assignment Versus Equality Marko Rauhamaa <marko@pacujo.net> - 2016-06-28 22:40 +0300
                Re: Assignment Versus Equality Gene Heskett <gheskett@shentel.net> - 2016-06-28 16:59 -0400
                Re: Assignment Versus Equality Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2016-06-30 12:29 +1200
                Re: Assignment Versus Equality Steven D'Aprano <steve@pearwood.info> - 2016-06-30 12:50 +1000
                Re: Assignment Versus Equality Marko Rauhamaa <marko@pacujo.net> - 2016-06-30 09:22 +0300
                Re: Assignment Versus Equality Steven D'Aprano <steve@pearwood.info> - 2016-06-29 12:27 +1000
                Re: Assignment Versus Equality Rustom Mody <rustompmody@gmail.com> - 2016-06-28 20:52 -0700
                Re: Assignment Versus Equality Rustom Mody <rustompmody@gmail.com> - 2016-06-28 21:03 -0700
                Re: Assignment Versus Equality Random832 <random832@fastmail.com> - 2016-06-29 00:52 -0400
              Re: Assignment Versus Equality Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-06-27 18:14 -0700
            Re: Assignment Versus Equality Gene Heskett <gheskett@shentel.net> - 2016-06-27 11:21 -0400
          Re: Assignment Versus Equality Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2016-06-27 20:04 -0400
    Re: Assignment Versus Equality Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2016-06-26 11:21 -0400
      Re: Assignment Versus Equality Cousin Stanley <HooDunnit@didly42KahZidly.net> - 2016-06-26 08:47 -0700
        Re: Assignment Versus Equality BartC <bc@freeuk.com> - 2016-06-26 16:56 +0100
          Re: Assignment Versus Equality Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2016-06-27 11:38 +1200
          Re: Assignment Versus Equality Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2016-06-27 07:30 -0400
            Re: Assignment Versus Equality Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2016-06-28 18:17 +1200
          Re: Assignment Versus Equality Grant Edwards <grant.b.edwards@gmail.com> - 2016-06-27 13:59 +0000
            Re: Assignment Versus Equality Marko Rauhamaa <marko@pacujo.net> - 2016-06-27 17:09 +0300
              Re: Assignment Versus Equality sohcahtoa82@gmail.com - 2016-06-27 17:33 -0700
                Re: Assignment Versus Equality Marko Rauhamaa <marko@pacujo.net> - 2016-06-28 07:25 +0300
                Re: Assignment Versus Equality Rustom Mody <rustompmody@gmail.com> - 2016-06-27 23:54 -0700
            Re: Assignment Versus Equality Rustom Mody <rustompmody@gmail.com> - 2016-06-27 07:10 -0700
              Re: Assignment Versus Equality Steven D'Aprano <steve@pearwood.info> - 2016-06-29 12:35 +1000
                Re: Assignment Versus Equality Chris Angelico <rosuav@gmail.com> - 2016-06-29 14:19 +1000
                Re: Assignment Versus Equality Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-06-28 21:51 -0700
                Re: Assignment Versus Equality Chris Angelico <rosuav@gmail.com> - 2016-06-29 15:07 +1000
                Re: Assignment Versus Equality Rustom Mody <rustompmody@gmail.com> - 2016-06-28 22:55 -0700
                Re: Assignment Versus Equality Chris Angelico <rosuav@gmail.com> - 2016-06-29 16:26 +1000
                Re: Assignment Versus Equality Rustom Mody <rustompmody@gmail.com> - 2016-06-28 23:33 -0700
                Re: Assignment Versus Equality Rustom Mody <rustompmody@gmail.com> - 2016-06-28 23:37 -0700
                Re: Assignment Versus Equality Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2016-06-29 15:26 +1000
                Re: Assignment Versus Equality Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-06-28 22:51 -0700
                Re: Assignment Versus Equality Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2016-06-29 16:45 +1000
                Re: Assignment Versus Equality Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-06-29 01:07 -0700
                Re: Assignment Versus Equality Chris Angelico <rosuav@gmail.com> - 2016-06-29 18:09 +1000
                Re: Assignment Versus Equality Steven D'Aprano <steve@pearwood.info> - 2016-06-29 22:36 +1000
                Re: Assignment Versus Equality BartC <bc@freeuk.com> - 2016-06-29 14:24 +0100
                Re: Assignment Versus Equality Chris Angelico <rosuav@gmail.com> - 2016-06-29 23:35 +1000
                Re: Assignment Versus Equality BartC <bc@freeuk.com> - 2016-06-29 15:47 +0100
                Re: Assignment Versus Equality Chris Angelico <rosuav@gmail.com> - 2016-06-29 23:34 +1000
                Re: Assignment Versus Equality BartC <bc@freeuk.com> - 2016-06-29 10:49 +0100
                Re: Assignment Versus Equality Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-06-29 02:56 -0700
                Re: Assignment Versus Equality BartC <bc@freeuk.com> - 2016-06-29 11:10 +0100
                Re: Assignment Versus Equality Rustom Mody <rustompmody@gmail.com> - 2016-06-29 03:24 -0700
            Re: Assignment Versus Equality Alain Ketterlin <alain@universite-de-strasbourg.fr.invalid> - 2016-06-27 16:48 +0200
              Re: Assignment Versus Equality Rustom Mody <rustompmody@gmail.com> - 2016-06-27 22:00 -0700
            Re: Assignment Versus Equality Steven D'Aprano <steve@pearwood.info> - 2016-06-28 11:34 +1000
          Re: Assignment Versus Equality MRAB <python@mrabarnett.plus.com> - 2016-06-27 16:27 +0100
            Re: Assignment Versus Equality Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-06-27 14:56 -0700
            Re: Assignment Versus Equality Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-06-27 15:45 -0700
              Re: Assignment Versus Equality BartC <bc@freeuk.com> - 2016-06-28 00:08 +0100
                Re: Assignment Versus Equality Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2016-06-27 20:11 -0400
                Re: Assignment Versus Equality BartC <bc@freeuk.com> - 2016-06-28 11:35 +0100
                Re: Assignment Versus Equality Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2016-06-28 18:59 +1200
            Re: Assignment Versus Equality Steven D'Aprano <steve@pearwood.info> - 2016-06-28 11:28 +1000
          Re: Assignment Versus Equality Grant Edwards <grant.b.edwards@gmail.com> - 2016-06-27 15:42 +0000
      Re: Assignment Versus Equality Marko Rauhamaa <marko@pacujo.net> - 2016-06-26 19:11 +0300
    Re: Assignment Versus Equality MRAB <python@mrabarnett.plus.com> - 2016-06-26 16:41 +0100
      Re: Assignment Versus Equality BartC <bc@freeuk.com> - 2016-06-26 17:08 +0100
    Re: Assignment Versus Equality Christopher Reimer <christopher_reimer@icloud.com> - 2016-06-26 11:53 -0700
      Re: Assignment Versus Equality Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2016-06-27 11:41 +1200
    Re: Assignment Versus Equality Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2016-06-27 11:22 +1200
      Re: Assignment Versus Equality BartC <bc@freeuk.com> - 2016-06-27 00:39 +0100
        Re: Assignment Versus Equality Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2016-06-28 18:15 +1200

csiph-web