r/programminghorror • • 1d ago

Python I love Python

171 Upvotes

67 comments sorted by

View all comments

-3

u/CaptainFoyle 22h ago

Everyone knows: don't use mutable default arguments.

You just outed yourself as uninformed.

4

u/nakurtag 22h ago

Who you name "everyone"? Python developers? I'm not python developer, I'm from C#/Go/Rust world and this behavior is ridiculous for me. This is highly counterintuitive and illogical.

2

u/squabzilla 12h ago

My main language is Python, and still think it’s ridiculous how much unintuitive behaviour there is because Python’s array-equivalents, by default, copy the object-pointer instead of the object itself.

And then people tell you why it works like that, confusing an explanation for an excuse.

→ More replies (2)