Skip to content
This repository has been archived by the owner on Nov 21, 2020. It is now read-only.

Replace module-level dict by immutable data type #7

Closed
McSinyx opened this issue Dec 31, 2019 · 2 comments
Closed

Replace module-level dict by immutable data type #7

McSinyx opened this issue Dec 31, 2019 · 2 comments
Labels
bug Something isn't working
Milestone

Comments

@McSinyx
Copy link
Owner

McSinyx commented Dec 31, 2019

For instance, device names can be handled more elegantly using named tuples. However, as discussed in cython/cython#2552, NamedTuple (or any class requiring type annotation) is not yet supported. I am noting this here to not forget about it.

@McSinyx McSinyx added the blocked Not our fault that this cannot be done (yet) label Dec 31, 2019
@McSinyx
Copy link
Owner Author

McSinyx commented Jan 23, 2020

For device names specifically, neither'd be wise choice, since both are mutable data types. I can imagine palace is imported multiple times by downstream (which imports the same instance) and one of the downstream accidentally modify the data. That's be messed up.

@McSinyx McSinyx changed the title Replace dict by typing.NamedTuple for enum data Replace module-level dict by immutable data type Jan 23, 2020
@McSinyx McSinyx removed the blocked Not our fault that this cannot be done (yet) label Jan 23, 2020
@McSinyx McSinyx added this to the 0.2 milestone Jan 23, 2020
@McSinyx McSinyx added the bug Something isn't working label Feb 2, 2020
@McSinyx
Copy link
Owner Author

McSinyx commented Mar 11, 2020

With Cython extension type, one can use cdef readonly for attributes to make a class for these value.

McSinyx added a commit that referenced this issue Mar 21, 2020
Namely buffer creation and device names (fix GH-7)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant