Friday, 6 September 2013

How do I pythonically set a value in a dictionary if it is None?

How do I pythonically set a value in a dictionary if it is None?

This code is not bad, but I want to know how good programmers will write
the code
if count.get('a') is None:
count['a'] = 0

No comments:

Post a Comment