On Wed, Nov 3, 2021, 9:19 PM Rob Cliffe via Python-ideas

> Some people clearly need it, viz. those who use a default such as `[]` and
> then ask on Stack Overflow why they get surprising results.


This is silly. All those folks on StackOverflow are told "use a sentinel."
The fact beginners can make a mistake doesn't mean a feature is wrong, it
means beginners are beginners.

They don't NEED it, there are existing solutions.

Even though I don't support this proposal, there are things that beginners
ask about that we don't NEED but are still worth adding.

For example, even though I was only lukewarm in support of the walrus
operator, I agree it makes a some code constructs more concise and more
readable. But it WAS new syntax to do the same thing that was already
possible with an extra line or two before.

I recognize that in many ways this proposal is similar. It's extra syntax
to make a certain coding pattern shorter. I don't believe that's absurd, I
just think the balance tips the other way. What this covers is less
important than what the walrus operator covers, because all syntax proposed
is uglier and less intuitive than walrus, and because it may obstruct a
much more important general feature is like to have added.



With late binding you can do anything that you can do with early binding,
> but not vice versa.  And IMO late binding is actually more intuitive - YMMV.
>

This seems exactly opposite the real situation. Late binding is completely
and straightforwardly handled by a sentinel. Yes, it doesn't make the
automatic help() that pretty. Yes it takes an extra line in the body. But
the semantics are available.

In contrast, how can a late binding call POSSIBLY know what the default
value was at the point of function definition?!

x = 1234
def foo(a, b=x):
    # ... whatever

x = 567
foo(88)

That definition-time value of 'x' is just lost.

I don't consider that behavior especially important, I admit. There are
plenty of names, and if you want one not to change, don't change it.

Indeed, if Python 0.9 had come with late binding, my feelings about Python
and it's popularity would probably be nearly identical. But it didn't. So
now we are discussing confusing and subtle syntax variations for a niche
use case, and I don't believe that's worthwhile.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/DBO6V7DDMXRLJ6YD2MFQI5XW65X6T3XL/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to