Python - Passing arguments to functions -


i sort of new python reading through pro python , had section passing variable keyword arguments function. after reading section wrote following code doesn't seem work.

def fun(**a):     return a['height'] if not {} else 0 

empty hash argument not guaranteed same object newly created empty hash.

try compare using a != {}, or a['height'] if else 0.

or without check:

return a.get('height', 0) 

Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -