Post #2476222
2026-05-02 12:13 UTC
@brass75@twit.social @qoyyuum@fosstodon.org I get mutable, even though it's a bit subtle here (via the assignment) . The gotcha here was only setting the default at first call, and then persisting it. I think the next reply in the thread picks up on that.
Replies (1)
-
@tshirtman@mas.to 2026-05-02 13:40
@grant_h@mastodon.social @brass75@twit.social @qoyyuum@fosstodon.org the default is not set at first call, it is at function definition time, an empty array is created and attached to the function signature like any default value would, then this same value (an array that was created empty, but might now be not empty anymore) is used every time no value is passed for that argument.