On 23 January 2017 at 13:05, Soni L. <fakedme...@gmail.com> wrote:
> Yeah but the dotequals operator has many other benefits:
>
> long_name .= __call__  # cast to callable
> long_name .= wrapped  # unwrap
> etc

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
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to