MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programminghorror/comments/1xfxtnx/i_love_python/19rouvqmzz341/?context=3
r/programminghorror • u/nakurtag • Oct 26 '26
81 comments sorted by
View all comments
Show parent comment
29
Which defeats the entire purpose of the default value feature.
29 u/notjfd Oct 26 '26 The default value is fine as long as it is not a mutable object. So things like integers and strings are completely fine to use as default values. -14 u/ZylonBane Oct 26 '26 Yes, we're all aware. Nobody has disputed that. 5 u/shunabuna Oct 26 '26 its probably for optimisation to reduce the amount of instructions needed to initiate a function call. On the plus side, its an easy place to define a cache -1 u/maikindofthai 28d ago No? The main purpose is so callers can omit the arg if they’re ok with the default. This still achieves that.
The default value is fine as long as it is not a mutable object. So things like integers and strings are completely fine to use as default values.
-14 u/ZylonBane Oct 26 '26 Yes, we're all aware. Nobody has disputed that.
-14
Yes, we're all aware. Nobody has disputed that.
5
its probably for optimisation to reduce the amount of instructions needed to initiate a function call. On the plus side, its an easy place to define a cache
-1
No? The main purpose is so callers can omit the arg if they’re ok with the default. This still achieves that.
View all comments
Show parent comment
29
u/ZylonBane Oct 26 '26
Which defeats the entire purpose of the default value feature.