core: Generalize __setitem__
and __getitem__
#487
Labels
No Milestone
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: M-Labs/nac3#487
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
A more advanced version of #460 and #482.
Technically, Python allows dunder methods like
__setitem__
and__getitem__
to be overriden in user-defined classes. For a dumb example:Right now,
nac3core
has other magic functions like__add__
and friends to deal with{u,}int{32,64}
andfloat
binary operations, etc.Builtin item assignment
__setitem__
and item lookups__getitem__
could also be implemented like this - as top-level builtin functions attributed to a primitive class (includinglist
s,ndarray
s, maybe a bit awkward forTypeEnum::Tuple
s since they are notTObj
and would require special checks in the type system).An extension to this is to add a feature to allow users to define their own
__setitem__
and__getitem__
in their own classes.This is considered low priority.