You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SimpleNamespace is used as a simple data record type, a simpler alternative to named tuples and dataclasses. Although it is easy to create a copy of a SimpleNamespace instance with modified attributes (SimpleNamespace(**vars(ns), attr=newvalue)), it would be convenient if SimpleNamespace be supported in copy.replace() which already supports named tuples and dataclasses.
It does not pass arguments to the constructor, but this is consistent with pickling and copying. In any case, a SimpleNmaespace subclass with constructor is very unusual.
Uh oh!
There was an error while loading. Please reload this page.
Feature or enhancement
SimpleNamespace is used as a simple data record type, a simpler alternative to named tuples and dataclasses. Although it is easy to create a copy of a SimpleNamespace instance with modified attributes (
SimpleNamespace(**vars(ns), attr=newvalue)
), it would be convenient if SimpleNamespace be supported incopy.replace()
which already supports named tuples and dataclasses.#108751
https://discuss.python.org/t/generalize-replace-function/28511
Linked PRs
The text was updated successfully, but these errors were encountered: