[Alexander Belopolsky] > > Do we want to protect users who > > cannot tell = from == so much that we are willing to cause Python to be > > the first language with two non-interchangeable assignment operators? >
[Steven D'Aprano][ Not even close to the first. Go beat us to it -- it has both = and := > assignment operators. > > Ocaml also has := for regular assignment and <- for assignment to > mutable fields. > > Similarly, Haskall has = for assignment definitions and <- for binding > in monads. > I skipped that part, because nobody actually cares ;-) But back when I looked at this, R had them all beat, and I never found a single source that actually managed to list _all_ of R's variations This source was clearest, but is missing (at least) all the ways to spell all the variations as function calls too: https://stat.ethz.ch/R-manual/R-devel/library/base/html/assignOps.html There are three different assignment operators: two of them have leftwards > and rightwards forms. > The operators <- and = assign into the environment in which they are > evaluated. The operator <- can be used anywhere, whereas the operator = is > only allowed at the top level (e.g., in the complete expression typed at > the command prompt) or as one of the subexpressions in a braced list of > expressions. > The operators <<- and ->> are normally only used in functions, and cause a > ... > .[click the link if you're still awake] >
_______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com