[Tutor] True and 1 [was Re: use of the newer dict types]
Jim Mooney
cybervigilante at gmail.com
Sat Jul 27 20:03:11 CEST 2013
On 27 July 2013 01:26, Alan Gauld <alan.gauld at btinternet.com> wrote:
> Most of what you said I knew, but I didn't realize it went so far as
> allowing arithmetic! Now I'm on the side of that being a bad thing.
>
> Booleans should be as distinct from numbers as chars
> are from strings... ;-)
I did this a while back and it took me some time to figure why I got
opposite results:
if [True]: print(True)
else: print(False)
# result: True
if [True] == True: print(True)
else: print(False)
# result: False
--
Jim
More information about the Tutor
mailing list