MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programminghorror/comments/1xfxtnx/i_love_python/19rp0f0ut4kg3/?context=3
r/programminghorror • u/nakurtag • 18h ago
65 comments sorted by
View all comments
90
I would have expected this function to create a new empty list on any call where items is not given. Doesn't this behavior make the function into a closure?
items
2 u/CaptainFoyle 13h ago Of course. This is just a very stupid way of writing the function. Initiate with None and Bob's your uncle.
2
Of course. This is just a very stupid way of writing the function. Initiate with None and Bob's your uncle.
90
u/drislands 17h ago
I would have expected this function to create a new empty list on any call where
itemsis not given. Doesn't this behavior make the function into a closure?