In message
<685761fe-b052-4d89-92d3-17d1f2a39...@p2g2000yqh.googlegroups.com>, Paul
McGuire wrote:
> While sifting through some code looking for old "x and y or z" code
> that might better be coded using "y if x else z", I came across this
> puzzler:
>
> x = and True or False
I suspect the
On May 3, 9:14 am, Steven D'Aprano wrote:
> If it is any arbitrary object, then "x and True or False" is just an
> obfuscated way of writing "bool(x)". Perhaps their code predates the
> introduction of bools, and they have defined global constants True and
> False but not bool. Then they removed
On May 2, 12:14 pm, Paul McGuire wrote:
> While sifting through some code looking for old "x and y or z" code
> that might better be coded using "y if x else z", I came across this
> puzzler:
>
> x = and True or False
>
> What is "and True or False" adding to this picture? The boolean
> expr
On Sun, 02 May 2010 10:14:44 -0700, Paul McGuire wrote:
> While sifting through some code looking for old "x and y or z" code that
> might better be coded using "y if x else z", I came across this puzzler:
>
> x = and True or False
>
> What is "and True or False" adding to this picture? Th
On May 2, 10:14 am, Paul McGuire wrote:
> While sifting through some code looking for old "x and y or z" code
> that might better be coded using "y if x else z", I came across this
> puzzler:
>
> x = and True or False
>
> What is "and True or False" adding to this picture? The boolean
> expr
On Sun, May 2, 2010 at 1:14 PM, Paul McGuire wrote:
> While sifting through some code looking for old "x and y or z" code
> that might better be coded using "y if x else z", I came across this
> puzzler:
>
> x = and True or False
>
> What is "and True or False" adding to this picture? The boo
Peter Otten wrote:
> def f():
> big_beast = list(range(10**100))
> return big_beast and True or False
> x = f()
>
> it would prevent that a big_beast reference becomes visible outside the
> function and allow for immediate release of its memory.
what's wrong in bool(big_beast)?
--
By Z
Paul McGuire wrote:
> While sifting through some code looking for old "x and y or z" code
> that might better be coded using "y if x else z", I came across this
> puzzler:
>
> x = and True or False
>
> What is "and True or False" adding to this picture? The boolean
> expression part is alr
While sifting through some code looking for old "x and y or z" code
that might better be coded using "y if x else z", I came across this
puzzler:
x = and True or False
What is "and True or False" adding to this picture? The boolean
expression part is already evaluating to a boolean, so I do