function - How to not specify default parameters in python? -
i'm working python package (mysqldb). connect method has lots of positional parameters, of have defaults, aren't easy deduce.
how can specify parameters want?
i.e. if connect method has following signature:
connect(username, password, socket, timeout)
and socket
has default value may system-dependent
is possible invoke following don't overwrite default value socket
:
connect('tom', 'passwd12', , 3)
try this:
connect(username='tom', password='passwd12', timeout=3)
for more information please see using optional , named arguments.
Comments
Post a Comment