Equivalent code to the bool() built-in function

Chris Angelico rosuav at gmail.com
Mon Apr 18 06:53:19 CEST 2011


On Mon, Apr 18, 2011 at 2:40 PM, Ned Deily <nad at acm.org> wrote:
> Chris Angelico:
>>  Dave Angel:
>> >>>> bool = int
>> Any language that allows you to do this is either awesome or
>> terrifying. Come to think of it, there's not a lot of difference.
>
> Even better:
> $ python2.7 -c 'False = True; print False'
> True

http://bofh.ch/bofh/bofh13.html

> Alas:
> $ python3 -c 'False = True; print(False)'
>  File "<string>", line 1
> SyntaxError: assignment to keyword

Someone in Python3 dev thinks it's a bad idea to shoot yourself in the foot.

Remind me some day to finish work on my "ultimate programming
language", which starts out with a clean slate and lets the programmer
define his own operators and everything.

Pro: The expression evaluator can be taught to interpret Dungeons &
Dragons notation - 2d6 means "random(1,6)+random(1,6)".
Con: The same expression might mean something completely different in
another program.

Pro: You can do anything.
Con: You can do anything.

ChrisA



More information about the Python-list mailing list