I think I'm -0.5 but I have a question for the people on here smarter than
me (pretty much all):
Is there some opportunity for some kind of compiler magic when the iterable
of a for loop is fully contained in a place easily findable by the
compiler, and not spread over multiple if and for statements?
I am imagining that something like this could be magically "looked into"
and made more efficient in some way, maybe by JIT complier or something:
for x for y in range(11, 100, 3) if (y % 10) for x in range(y):
frob(x)
compared to this:
for y in range(11, 100, 3):
if (y % 10);
for x in range(y):
frob(x)
Am I instilling too much faith in the power of the complier on this Ash
Wednesday morning? ;)
---
Ricky.
"I've never met a Kentucky man who wasn't either thinking about going home
or actually going home." - Happy Chandler
On Wed, Mar 2, 2022 at 7:13 AM Dennis Sweeney <[email protected]>
wrote:
> I've heard "evaluation map" for a related mathematical concept: the
> natural map from X to (X -> Y) -> Y in some cartesian closed category
> (whatever that means :-), like the natural embedding of a vector space into
> its double dual space, or like this sort of eval_at function that you can
> then plug into map:
>
> def eval_at(x):
> return lambda f: f(x)
> list(map(eval_at(arg), functions))
>
> It also reminds me of a Clojure feature, where IIRC a key can be used as a
> function so that `(:key mymap)` and `(mymap :key)` both mean "the value in
> `mymap` corresponding to the key `:key`"
> _______________________________________________
> 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/YFYX76ORCN4VTP2YZFWIBFIJDZ7MF7XZ/
> Code of Conduct: http://python.org/psf/codeofconduct/
>
_______________________________________________
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/WHV57KLYCHWJ47YV7BYOGP5YRAJCDOH4/
Code of Conduct: http://python.org/psf/codeofconduct/