[Tutor] Question about dictionary method get()
Dick Moores
rdm at rcblue.com
Mon Jun 28 08:34:34 EDT 2004
Francis Moore wrote at 05:07 6/28/2004:
>Dick,
>
>There's a good explanation of the dictionary get() method in Recipe 1.3
>of
>the O'Reilly Python Cookbook. There's a .pdf sample chapter at the
>following URL with this recipe in which you can download:
>
>http://www.oreilly.com/catalog/pythoncook/chapter/ch01.pdf
>
>It can probably explain it better than I can ;-)
Francis,
Wow, what a great resource! Yes, 1.3 is an understandable explanation,
EXCEPT FOR:
"If you call d.get(x), no exception is thrown: you get d[x] if x is a key
in d, and if it's not, you get None (which you can check for or propagate)."
How do I "check for or propagate" None?
Sorry for the basic questions.
Thanks,
Dick Moores
More information about the Tutor
mailing list