Vocabulary and Symbols Flashcards
break
while True: break
stop loop right now
class
class Person(object)
define a class
assert
assert False, “Error!”
assert (ensure) that something is true
continue
while True: continue
don’t process more of the loop, do it again
elif
else:
if:
except
except ValueError, e: print e
if an exception happens, do this
exec
exec ‘print “hello” ‘
run as a string in Python
finally
finally: pass
exceptions or not, finally do this no matter what
from
x from y
import a module into this one to use
global
global x
declare that you want a global variable
is
1 is 1 == True
like == to test equality
lambda
s = lambda y: y ** y; s(3)
create a short, anonymous function
not
not True == False
logical not
or
True or False == True
logical or
pass
def empty( ): pass
this block is empty