Hello,

any ideas why this does not work?

def add(key, num):
...     a[key] += num
...
a={}
a["007-12"] = 22 if not a.has_key("007-12") else add("007-12",22)
a
{'007-12': 22} # OK here, this is what I want
a["007-12"] = 22 if not a.has_key("007-12") else add("007-12",22)
a
{'007-12': None} # why does this became None?

Thanks

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to