Reputation: 467
Can I call a function using the default value for some arguments but not for all?
Take numpy.random.lognormal(mean=0.0, sigma=1.0, size=None)
as an example,
I want to call it with default mean and sigma but not default size.
Something in my mind is like np.random.lognormal(_,_,2)
, but this does not work
Is it possible to do that?
Upvotes: 0
Views: 30
Reputation: 12581
Yes, this is possible. Simply provide the argument you want to override:
np.random.lognormal(size=2)
This is precisely where named arguments become useful.
Upvotes: 2