kalekundert / byoc

MIT License
0 stars 0 forks source link

Allow mutable default values. #6

Closed kalekundert closed 3 years ago

kalekundert commented 3 years ago

Currently, default values can't be mutable (e.g. []), because they're instantiated when the class is being setup, and are therefore shared between all instances of a class.

Some solutions:

Make a copy of the default for each object:

Provide a way to specify a callable:

kalekundert commented 3 years ago

How other libraries do it: