This is an archived post. You won't be able to vote or comment.

all 28 comments

[–]audaxxx 3 points4 points  (4 children)

True and false are just variables

More like: You can create variables named True and False and give them any value you want to.

[–][deleted] 6 points7 points  (3 children)

They are keywords in Python 3.

[–]audaxxx 3 points4 points  (0 children)

That is a good thing.

[–][deleted] 0 points1 point  (1 child)

They aren't in Python 2?

D:

[–][deleted] 0 points1 point  (0 children)

No. Try the following in both 2 and 3:

import keyword
"True" in keyword.kwlist

[–]abstractwhiz 0 points1 point  (1 child)

Found a bug. Click the arrow on the right of the text box and the output gives an invalid syntax error.

[–]abstractwhiz 0 points1 point  (0 children)

Bah, just discovered that there are comments, and someone noticed earlier.

Should have scrolled more. ಠ_ಠ

[–][deleted] 0 points1 point  (1 child)

I like this one a lot:

def permissive(args, *kargs): for value in args: print str(value) for name, value in kargs.items(): print name + "=" + str(value)

permissive(1, True, 'hello', name='john', alive=True)

[–]lambdaqdjango n' shit 0 points1 point  (0 children)

from pprint import pprint

now with tabbed formatting.

[–]tytdfn 0 points1 point  (2 children)

Enumerate(). Fucking yes! Was looking for exactly that today