Reference

Chris Angelico rosuav at gmail.com
Tue Mar 4 23:01:43 CET 2014


On Wed, Mar 5, 2014 at 8:53 AM, Alexander Blinne <news at blinne.net> wrote:
> Am 04.03.2014 15:06, schrieb Chris Angelico:
>> https://github.com/Rosuav/ExceptExpr/blob/master/find_except_expr.py
>
> I have always found it quite nice that the python parser is so easy to
> use from within python itself.

Yes. Until I put together the original version of that, to search for
PEP 463 translation candidates, I'd never used the ast module other
than for literal_eval. It's marvelously powerful.

>> Run across the Python stdlib, that tells me there are 4040 uses of
>> is/is not, of which 16 compare against False, 18 against True (see?
>> Python has a bias for truth above falsehood!), and 3386 against None.
>
> I think i will have to rephrase my "is False" condition to make it more
> truthy :)

if x is False:

-->

if not x:

ChrisA



More information about the Python-list mailing list