Re: [Python-ideas] Immutable Builder" Pattern and Operator

Paul Moore is clearly right when He says that this "a .= 1+1" doesn't make sense. It means nothing understandable although in "a .= s(e)" can mean something. As a matter of fact "a .= EXPR" is bound to succeed only in a very small set of cases. On Jan 23, 2017 14:39, <python-ideas-request@python.org> wrote: Send Python-ideas mailing list submissions to python-ideas@python.org To subscribe or unsubscribe via the World Wide Web, visit https://mail.python.org/mailman/listinfo/python-ideas or, via email, send a message with subject or body 'help' to python-ideas-request@python.org You can reach the person managing the list at python-ideas-owner@python.org When replying, please edit your Subject line so it is more specific than "Re: Contents of Python-ideas digest..." Today's Topics: 1. Re: "Immutable Builder" Pattern and Operator (Paul Moore) 2. Re: "Immutable Builder" Pattern and Operator (Soni L.) 3. Re: Python-ideas Digest, Vol 122, Issue 81 (Herv? Kyle MUTOMBO) ---------------------------------------------------------------------- Message: 1 Date: Mon, 23 Jan 2017 13:26:49 +0000 From: Paul Moore <p.f.moore@gmail.com> To: "Soni L." <fakedme+py@gmail.com> Cc: Python-Ideas <python-ideas@python.org> Subject: Re: [Python-ideas] "Immutable Builder" Pattern and Operator Message-ID: <CACac1F9qo=1Zr7-YW+rCYBCQMV7cu7BRC9WrCR3ZNMkJ+E8iQA@mail.gmail.com> Content-Type: text/plain; charset=UTF-8 On 23 January 2017 at 13:05, Soni L. <fakedme+py@gmail.com> wrote:
Those don't seem particularly clear to me.
And it also looks neat.
Well, we have to agree to differ on that one. Also, the semantics of the proposed operation are very odd. If I understand your proposal a .= b(c) doesn't evaluate b(c) (It can't, as b is a method of a and doesn't make sense on its own), but rather combines the LHS and RHS with a dot - so it's defined in terms of rewriting the input rather than as an operation on the subexpressions. There's no other operator in Python that I'm aware of that works like this. What grammar would you allow for the RHS? So far you've shown LHS .= METHOD(ARGS) LHS .= ATTRIBUTE Clearly, LHS .= EXPR makes no sense in general (consider a .= 1+1). On the other hand, what about LHS .= ATTRIBUTE[INDEX] ? I'm guessing you'd want that allowed? Frankly, I don't think the benefits are even close to justifying the complexity. Paul ------------------------------ Message: 2 Date: Mon, 23 Jan 2017 11:33:26 -0200 From: "Soni L." <fakedme+py@gmail.com> To: "M.-A. Lemburg" <mal@egenix.com> Cc: "python-ideas@python.org" <python-ideas@python.org> Subject: Re: [Python-ideas] "Immutable Builder" Pattern and Operator Message-ID: <e36e68d0-826f-db35-af31-11b330c57226@gmail.com> Content-Type: text/plain; charset=windows-1252; format=flowed ... I need a better email client. *double-checks I got everything right this time...* On 23/01/17 11:30 AM, Soni L. wrote:
------------------------------ Message: 3 Date: Mon, 23 Jan 2017 14:38:40 +0100 From: Herv? "Kyle" MUTOMBO <hervinhioslash@gmail.com> To: python-ideas@python.org Subject: Re: [Python-ideas] Python-ideas Digest, Vol 122, Issue 81 Message-ID: <CAKX-YRBEy+jf713qP4GY+Q6HFwMGXxHNKNSLpVPf34T-z+Pecg@mail.gmail.com> Content-Type: text/plain; charset="utf-8" Pleasing to see and somehow elegant. I believe .= is a good idea. On Jan 23, 2017 14:18, <python-ideas-request@python.org> wrote:

On 23 January 2017 at 13:47, Hervé "Kyle" MUTOMBO <hervinhioslash@gmail.com> wrote:
By responding to a digest you make it very hard to see what you're replying to. Could you get the messages as individual ones, and reply quoting the context properly, please? I'm not sure how to interpret your above comment in the light of your other comment
Pleasing to see and somehow elegant. I believe .= is a good idea.
as I'm arguing pretty strongly that .= is *not* a good idea, because there are all sorts of ill-defined cases that haven't been clearly explained in a way that matches the rest of Python's grammar and semantics. Paul

On 23 January 2017 at 13:47, Hervé "Kyle" MUTOMBO <hervinhioslash@gmail.com> wrote:
By responding to a digest you make it very hard to see what you're replying to. Could you get the messages as individual ones, and reply quoting the context properly, please? I'm not sure how to interpret your above comment in the light of your other comment
Pleasing to see and somehow elegant. I believe .= is a good idea.
as I'm arguing pretty strongly that .= is *not* a good idea, because there are all sorts of ill-defined cases that haven't been clearly explained in a way that matches the rest of Python's grammar and semantics. Paul
participants (2)
-
Hervé "Kyle" MUTOMBO
-
Paul Moore