Sent from my iPhone
> A thought just occurred to me. Maybe we should just add a Boolean class to
> numbers?
This makes lots of sense to me.
Bool is a subclass of int — might as well embrace that fact.
-CHB
___
Python-ideas mailing list
Python-ideas@py
On 02/15/2018 11:55 PM, Nick Coghlan wrote:
On 16 February 2018 at 12:19, rym...@gmail.com wrote:
I don't know...to me this looks downright ugly and an awkward special case.
It feels like it combines reading difficulty of inline assignment with the
awkwardness of a magic word and the ugliness
Hi list,
> But when it comes to something like
> [f(x) + g(f(x)) for x in range(10)]
> you find you have to sacrifice some readableness if you don't want two
f(x)
> which might slow down your code.
>
> Someone may argue that one can write
> [y + g(y) for y in [f(x) for x in range(10)]]
personally
On 16/02/18 02:06, Nick Coghlan wrote:
The recent thread on variable assignment in comprehensions has
prompted me to finally share
https://gist.github.com/ncoghlan/a1b0482fc1ee3c3a11fc7ae64833a315 with
a wider audience (see the comments there for some notes on iterations
I've already been through
On 16 February 2018 at 18:36, Kirill Balunov wrote:
> What about (| val = get_value(x) |) assignment expression which will be True
> if success, and None if not?
>
> So it will be value = f() if (| f = calculate |) else default…The idea is
> inspired from C’s assignment, but needs some special tre
What about (| val = get_value(x) |) assignment expression which will be True
if success, and None if not?
So it will be value = f() if (| f = calculate |) else default…The idea is
inspired from C’s assignment, but needs some special treatment for anything
which is False in boolean context.
With k