On Thu, Nov 04, 2021 at 04:36:27AM +1100, Chris Angelico wrote:
> You use the name because you can't refer to it other than by name, and
> that's fine. But it's the *default* that is different. Not the
> parameter.
Wait, are you saying that the list display here:
parameter=[]
is different from the list display here?
parameter=>[]
Well obviously they are distinct *objects*, but we consider
that the semantics of the [] is the same here:
a = []
b = []
even though a and b get distinct objects. So we should ignore the fact
that they give distinct objects.
What if we use a singleton as our default?
parameter=None
parameter=>None
Now there's only a single object involved. There is no question at all
that the token `None` refers to exactly the same thing in both cases. We
cannot possibly say that "it's the *default* that is different" in this
case, that one of the Nones is different from the other.
But one parameter is still early bound and the other is still
late-bound.
It's not the binding itself that is different (the implementations are
the same: we have a slot with a pointer to an object), and it's not the
None defaults that are different, because there is only one None. It
must be the parameter that is different.
> I agree that both of those are horrible. That's why I'm not advocating either
> :)
I've lost track of what your preferred syntax is. It is this?
# move parameter name into the expression
parameter=>expression
--
Steve
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/EAT5Y3TZXRJQBODVQWZ3WF3JT5X456CH/
Code of Conduct: http://python.org/psf/codeofconduct/