Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #22171
| Date | 2012-03-26 12:56 +0200 |
|---|---|
| From | Kiuhnm <kiuhnm03.4t.yahoo.it> |
| Newsgroups | comp.lang.python |
| Subject | Re: Documentation, assignment in expression. |
| References | (3 earlier) <4F6F1792.1060709@tim.thechases.com> <CAPTjJmpnYxZkLGQ4Tksw-2aaG5KAgPwoUe0EP8_OW8MdsijPdA@mail.gmail.com> <mailman.968.1332683287.3037.python-list@python.org> <4f6f36bf$0$1390$4fafbaef@reader2.news.tin.it> <mailman.985.1332751983.3037.python-list@python.org> |
| Message-ID | <4f704b5e$0$1389$4fafbaef@reader2.news.tin.it> (permalink) |
| Organization | TIN.IT (http://www.tin.it) |
On 3/26/2012 10:52, Devin Jeanpierre wrote:
> On Sun, Mar 25, 2012 at 11:16 AM, Kiuhnm
> <kiuhnm03.4t.yahoo.it@mail.python.org> wrote:
>> On 3/25/2012 15:48, Tim Chase wrote:
>>>
>>> The old curmudgeon in me likes the Pascal method of using "=" for
>>> equality-testing, and ":=" for assignment which feels a little closer to
>>> mathematical use of "=".
>>
>>
>> Unfortunately, ":=" means "is defined as" in mathematics. The "right"
>> operator would have been "<-".
>
>
> "Is defined as" is actually pretty reasonable. "Define this to be
> that" is a common way to speak about assignment. Its only difference
> is the present tense. For example, in Python, "def" stands for
> "define", but we can overwrite previous definitions::
>
> def f(x): return x
> def f(x): return 2
> f(3) == 2
>
> In fact, in pretty every programming language that I know of with a
> "define" assignment verb, this is so. For example, in Scheme, x is 2
> at the end::
>
> (define x 1)
> (define x 2)
> x
When you write
(define x 1)
(define x 2)
x
or, in F# and OCaml,
let x = 1
let x = 2
x
you're saying
x = 1
{
x = 2
x
}
You don't modify 'x': you hide it by defining another "value" (not
variable) with the same name.
Indeed,
let x = 1
let x = 2
x
is shorthand for
let x = 1 in
let x = 2 in
x
Kiuhnm
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Documentation, assignment in expression. Alexander Blinne <news@blinne.net> - 2012-03-23 23:59 +0100
Re: Documentation, assignment in expression. Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-03-23 21:09 -0400
Re: Documentation, assignment in expression. Alexander Blinne <news@blinne.net> - 2012-03-25 14:18 +0200
Re: Documentation, assignment in expression. Tim Chase <python.list@tim.thechases.com> - 2012-03-25 08:03 -0500
Re: Documentation, assignment in expression. Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-03-26 05:36 +0000
Re: Documentation, assignment in expression. Terry Reedy <tjreedy@udel.edu> - 2012-03-26 12:00 -0400
Re: Documentation, assignment in expression. Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2012-03-26 15:59 +0200
Re: Documentation, assignment in expression. Tim Chase <python.list@tim.thechases.com> - 2012-03-26 12:42 -0500
Re: Documentation, assignment in expression. Chris Angelico <rosuav@gmail.com> - 2012-03-26 00:11 +1100
Re: Documentation, assignment in expression. Tim Chase <python.list@tim.thechases.com> - 2012-03-25 08:48 -0500
Re: Documentation, assignment in expression. Kiuhnm <kiuhnm03.4t.yahoo.it> - 2012-03-25 17:16 +0200
Re: Documentation, assignment in expression. Tim Chase <python.list@tim.thechases.com> - 2012-03-25 13:22 -0500
Re: Documentation, assignment in expression. Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-03-26 05:47 +0000
Re: Documentation, assignment in expression. Devin Jeanpierre <jeanpierreda@gmail.com> - 2012-03-26 04:52 -0400
Re: Documentation, assignment in expression. Kiuhnm <kiuhnm03.4t.yahoo.it> - 2012-03-26 12:56 +0200
Re: Documentation, assignment in expression. Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2012-03-26 14:13 +0300
Re: Documentation, assignment in expression. Kiuhnm <kiuhnm03.4t.yahoo.it> - 2012-03-26 13:58 +0200
Re: Documentation, assignment in expression. rusi <rustompmody@gmail.com> - 2012-03-25 09:17 -0700
Re: Documentation, assignment in expression. mwilson@the-wire.com - 2012-03-25 19:09 -0400
Re: Documentation, assignment in expression. Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-03-25 22:29 -0400
Re: Documentation, assignment in expression. mwilson@the-wire.com - 2012-03-26 07:27 -0400
Re: Documentation, assignment in expression. Chris Angelico <rosuav@gmail.com> - 2012-03-26 01:11 +1100
Re: Documentation, assignment in expression. Kiuhnm <kiuhnm03.4t.yahoo.it> - 2012-03-25 17:17 +0200
Re: Documentation, assignment in expression. Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-03-25 18:59 -0400
Re: Documentation, assignment in expression. Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2012-03-26 15:54 +0200
Re: Documentation, assignment in expression. Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-03-26 12:16 -0400
Re: Documentation, assignment in expression. Tim Chase <python.list@tim.thechases.com> - 2012-03-26 05:14 -0500
Re: Documentation, assignment in expression. Roy Smith <roy@panix.com> - 2012-03-23 21:37 -0400
csiph-web