Replying out of order:

[Steven D'Aprano]

> Under your proposal, that becomes:
> def bench(name, cleanup=None with ???, *, seconds=1, repeat=3):
> except I'm not really sure what goes in the ??? for an empty parameter
> list.


I know I tend to write long-winded responses, but please read them fully
before replying.
I covered this.

 [Steven D'Aprano]

> But whatever it is, do you still think it is obvious that people
> will recognise "None" to mean a function without having to backtrack?


It's not clear what you mean by backtracking at this point. cleanup=None
with() requires no more backtracking than any other compound expression.
cleanup=children.oldest().room doesn't tell you what kind of object is
being assigned to cleanup. Is it a function? Who knows? Even if you know
what
'children' is and what the 'oldest' method returns, you still don't know
what's being assigned to cleanup without reading the entire expression.

There has never been a guarantee that expressions evaluate left to right
simply by virtue of the fact that an order of operations exists. The LL(1)
parser limits parsing complexity to expressions which require at most one
token look-ahead. Usually (I'll come back to this) that isn't hard for
humans who process text in chunks of multiple tokens at a time.

 [Steven D'Aprano]

> And from the threading tests:
> t = threading.Thread(target=lambda: None)


t = threading.Thread(target=None with())

seems pretty straight-forward to me.

 [Steven D'Aprano]

> sm = difflib.SequenceMatcher(isjunk=x == ' ' with x, ...)
> The expression x==' ' doesn't look like a function to me.


You don't think that perhaps that's because it's brand new syntax?
x=='' doesn't
look like a function because it's not a function. You could play the same
game with literally any compound expression:

>>> func = ", ".join

", " doesn't look like a function to me!

 [Steven D'Aprano]

> > Ideally, we could move that noise out of the way so that the intent is
> more
> > clearly expressed:
> So you say.
> I say it isn't noise, and if you ask me to express my intent, I'll state
> that it is a function first and at the beginning of the expression, not
> the end.


Don't you think that depends on the situation at all? Don't you think there
are cases where
the fact that you're passing a function and the call signature of said
function are exceedingly clear from context?

ui_element.on_mousover(<do something> with event)

We already have a way to declare a function signature first. If you think
it's paramount, then just def it.

If you honestly don't understand my position at all. If it's always a
surprise to you that ", ".join() takes an iterable of strings
or that sorted takes a key-function that takes element from the iterable
being sorted, or that on_mousover takes a function that takes an event
object
etc. etc. etc. then I guess I've never met anyone quite like you. I don't
know how to communicate my point of view any better than I already have.

[Steven D'Aprano]

> You are judging that from the perspective of someone whose native
> language makes it easy to say "sorted by foo" (for some value of foo).


This argument is such a tiring distraction. Please stop. If it's all just
random symbols to some non-english speaker, then
It doesn't matter either way to them. They can still deal with tokens in
the same way as the LL(1) parser. Only one look-ahead.
That's not at all how the world works, but I don't have the energy to get
into that discussion right now.

I've been writing a veritable novel on my views on lambda for over a week
now and people keep re-tredding the same ground.

[Steven D'Aprano]

> We shouldn't judge syntax proposals just on the cases that are carefully
> chosen to showcase them at their best. Especially not trivial cases.


We can judge it by examining cases where it might be problematic, but
there's no way to keep people from abusing
coding constructs to produce unreadable code, so just throwing out random
chunks of code like

a.b[c:d]-e**f(g, h=i) + {j & k, l*(m-n(o,p))} with e, k

then saying "looks bad to me" offers no insight into the pros and cons of
the proposal.
Well, yeah. It looks bad because it's terrible code.

It feels like you're not even trying to understand the basic premise of my
position. Otherwise, I would be delighted to move
past the simplified examples and on to more complex and probably
troublesome counter examples. Hell, we can talk about how
this would effect blind space aliens who can only hear ultra-sonic chirps
and are essentially incapable of learning English after we get
past this roadblock...
_______________________________________________
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