[Tutor] Misc question about scoping

Dave Angel davea at ieee.org
Fri Jun 4 22:23:26 CEST 2010


Hugo Arts wrote:
> On Fri, Jun 4, 2010 at 1:23 PM, Dave Angel <davea at ieee.org> wrote:
>   
>> I'd prefer the form:
>>
>>  flag =ot not (someValue or another)
>>
>>     
>
> That's a construct you might commonly find in languages like C, but I
> don't think it's very pythonic. If you want to convert your result to
> a bool, be explicit about it:
>
> flag =ool(some_value or another)
>
> I'd agree that the if/else construct is redundant if you just want a
> True/False result, but the double not is a kind of implicit type
> conversion that is easily avoided.
>
> Hugo
>
>   
I'd certainly agree that bool() is better than not not.  And I admit a C 
background.

DaveA



More information about the Tutor mailing list