[Python-ideas] x )= f as shorthand for x=f(x)
Jim Jewett
jimjjewett at gmail.com
Fri Nov 9 22:12:55 CET 2007
Boris,
I'm posting this publicly because you aren't the first to feel this
way, so I think an answer should be archived.
On 11/9/07, Boris Borcic <bborcic at gmail.com> wrote:
> Guido van Rossum wrote:
> > Boris, give it up. That syntax is never going to fly. If you have to
> > ask why, you're just not cut out to be a language designer.
> I did not intend to pose as a language designer.
Suggesting a change in python is acting (in a small way) as a language designer.
> came up with the closest approximation to a solution I could invent,
Which is fine.
The catch is that no one -- not even Guido -- gets everything right
the first time.
There is a natural desire to just tweak the proposal to work, or even
to explain why things are already OK. For a good proposal, you need
to do this to make it great. Unfortunately, that turns out to be
running in circles for the proposals that -- like most proposals --
turn out to be dead ends.
So you need to be willing to step back and figure out
(1) How important the problem really is.
(2) How expensive the proposed solutions really are.
> I must admit I wasn't expecting the discussion to rely so quickly on
> involving my character.
I don't think that was anyone's intent.
I suspect you were thinking of lines like:
> > That syntax is never going to fly. If you have to
> > ask why, you're just not cut out to be a language designer.
These don't mean you're bad person; they just mean that you don't yet
know how to answer those two questions the same way Guido (for
example) would.
> In conclusion, I guess I'm warranted to take this to mean "we can
> dream up no appropriate syntax".
Yes, but there is also a question about whether to do it at all. Remember that
x = f(x)
is one step of reduce -- and reduce is something Guido wants to take
back out of the language because, in practice, it is too confusing.
(a) Is this operation frequent enough to be worth a syntactic
shortcut? Would it actually make the code easier to read?
(b) Is the sort of code that uses this operation something that
should be encouraged? Or is making it hard a *good* thing that steers
people towards other idioms?
> PS,FYI : a notation borne from letting parens live independent lives,
> and indeed could fly http://en.wikipedia.org/wiki/Bra-ket_notation
The question isn't whether it is possible, but whether it is worth the
cost. The costs are different for physics and for a generic
programming language -- and different still for Python in particular.
-jJ
More information about the Python-ideas
mailing list