Python shortcut for variable default value to be another variable value if it is None
本问题已经有最佳答案,请猛点这里访问。
我有以下功能声明:
1 | def set_data(obj=None, name='delp', type=None): |
是否有一个python快捷方式,如果类型为none,则类型等于'name'值(传递的默认r)?
(P)The usual idim is:(p)字母名称(P)(But don't actually use EDOCX1 commercial 0-as a variable name,it'll mask the built in function as described here:is it safe to use the python word"type"in my code?)(p)