true = 1
Mark McEahern
marklists at mceahern.com
Fri Jan 11 20:24:31 EST 2002
I don't know whether this has ever been proposed, but how about built-in
"constants" for true and false?
true = 1
false = 0
This leads to eminently (slightly, negligibly?) more readable code; e.g.,
def foo(boolean):
if boolean:
print "true"
else:
print "false"
foo(boolean=true)
or:
boolean = true
foo(boolean)
Instead of:
foo(boolean=1)
or:
boolean = 1
foo(boolean)
tru'ly yours,
// mark
More information about the Python-list
mailing list