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
{{ message }}
Repository navigation
Ability to override __slots__ with custom descriptors, especially non-data #5
It is currently not possible for a class to define an attribute in the __slots__ (therefore generating a descriptor behind the scenes) and then to define a descriptor on that class with the same name.
However that would be desirable in certain cases. For example in the case of pyfields : in case of a NativeField (a field with no hook on set), for example obtained with field(default=1), that descriptor is implemented with a non-data descriptor overriding itself with the default value on first get, or replaced by user-provided value on first set. It could therefore easily fallback to the slot descriptor after first get or set.
frompyfieldsimportfieldclassA:
# __slots__ = ('a', ) <-- this does not worka=field(default=1)
changed the title [-][pyfields] ability to override `__slots__` with custom descriptors, especially non-data[/-][+]Ability to override `__slots__` with custom descriptors, especially non-data[/+]on Sep 7, 2020
Activity
[-][pyfields] ability to override `__slots__` with custom descriptors, especially non-data[/-][+]Ability to override `__slots__` with custom descriptors, especially non-data[/+]