
On Thu, Nov 4, 2021 at 9:33 AM Ethan Furman <ethan@stoneleaf.us> wrote:
On 11/3/21 2:31 PM, Chris Angelico wrote:
On Thu, Nov 4, 2021 at 5:54 AM Ethan Furman wrote:
On 11/3/21 12:13 AM, Chris Angelico wrote:
Python has a strong policy of evaluating things immediately, or being very clear about when they will be evaluated
Putting the marker in the middle of the name binding expression is not "very clear" -- particularly since the advice is "no spaces around '=' in function headers and calls".
[typo above fixed: 'ne' -> 'no'
Not sure what you mean,
I mean the same thing that D'Aprano has reiterated several times:
def do_something_fun(target:Any, action:int=-1, permissions:int=>target.perm): pass
vs
def do_something_fun(target:Any, action:int=-1, @permissions:int=target.perm): pass
Having the `@` in front instead of buried in the middle is clear, and just like the * and ** in `*args` and `**kwds` signals that those are different types of variables, the @ in `@permissions` signals that `permissions` is a different kind of variable -- and yes, the fact that it is late-bound does make it different; to claim otherwise is akin to claiming that `args` and `kwds` aren't different because in the end they are just names bound to objects.
[snip javascript example]
Is your javascript example trying to show that putting the sigil in front is nonsensical? If no, then what? If yes, then it is plain that you and I simply disagree and neither of us is going to convince the other.
It's demonstrating that a plain equals sign can mean late-binding in some languages and early-binding in others. Both of those are perfectly normal interpretations. You were quoting something where I was talking about deferreds that would be evaluated on usage, potentially much later in the function, and I'm saying that that makes no sense. I'm also saying that there is no difference between the variables, only the defaults, and therefore that they shouldn't be adorned in this way. But that's clearly something where neither of us is going to convince the other. ChrisA