I have the following function declaration:
def set_data(obj=None, name='delp', type=None):
Is there a python shortcut, where type is equal with 'name' value(default r passed) if is None ?
I have the following function declaration:
def set_data(obj=None, name='delp', type=None):
Is there a python shortcut, where type is equal with 'name' value(default r passed) if is None ?
The usual idiom is:
def set_data(obj=None, name='delp', type=None):
if type is None:
type = name
(But don't actually use type
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?)