yeah, usually the workaround is to have items = None as the default, and then some kind of check at the top of the function like items = items if items else []
looking at it now I see why it's weird lol but you definitely get used to it
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
View all comments
Show parent comment
90
u/drislands Oct 26 '26
Devastating. I would not have expected that behavior, and I think it would wise to avoid it wherever possible.