Open zhindes opened 2 weeks ago
FYI, https://stackoverflow.com/questions/472000/usage-of-slots has some interesting details:
__dict__
to slots. We would want to avoid this.__weakref__
to slots. It may make sense to continue to allow weak references to Task objects, if nothing else.__class__
unless the slots match. I don't think this is a problem because we only do this with subclasses and all of the subclasses set slots already.
A few classes that contain DAQmx attributes are missing slots declarations. This can cause confusion if a user typo's one of our attribute names and then nothing useful happens.
For example, this code doesn't do what you expect, because the attribute is called
samp_quant_samp_per_chan
even though thecfg_implicit_timing
function variable name issamps_per_chan
for the same setting. Fun!Templates that have attributes that don't have slots (bad!):
There are some iffy ones... e.g., collections don't have properties, only functions. But maybe they should have slots not to confuse people? idk. https://github.com/ni/nidaqmx-python/blob/master/src/codegen/templates/task/collections/_ai_channel_collection.py.mako. I think starting with that list above is good enough for now.
Note: this was create in response to an internal issue: Bug 2924340: Setting non-existent attribute on the CO timing does not cause assertion in python