Python default parameter value replacement (last update: 2016-04-03, created: 2016-04-03) back to the list ↑
|
|||
A simple code that substitutes one of the default arguments in a given function, with a new value. It's a child of a late night discussion and should probably not be used in production-quality code. Also, it doesn't add a default value for a parameter if that doesn't exist - just replaces an already existing one. Testing on Python 2.7.3 on 64-bit Windows 10.
def a(k, x=1,y=2): Output: > test.py | |||
|