[Tutor] get() method for dictionaries

Christopher Spears cspears2002 at yahoo.com
Mon Mar 15 19:34:39 EST 2004


Why do we need the get() method for dictionaries?  On
the surface, there doesn't seem to be a whole of
difference between:

d = {}
d[1] = "stuff"
d[1]
'stuff'

and

d.get(1)
'stuff'





More information about the Tutor mailing list