-
Notifications
You must be signed in to change notification settings - Fork 347
Open
Description
If the user instantiates multiple Distance objects, the descriptors will interfere with each other.
There are two (and-a-half) ways to fix this:
- Attach a
weakref.WeakKeyDictionaryto instances ofMeter. Useinstanceas the key andvalueas the value. This has the disadvantage thatDistancemust be hashable and probably should not override__eq__(). - Place the information in an attribute of the
Distanceobjects. This has the disadvantage of requiring cooperation between theDistanceclass and theMeterclass. This requirement can be eased with the use of a metaclass, but never truly eliminated. - (variation of 2) Turn
Distance.meterinto a@property(or raw attribute) and delete theMeterclass entirely.
Metadata
Metadata
Assignees
Labels
No labels