Geet-George / halodrops

HALO Dropsondes' Protocol & Software
https://halodrops.readthedocs.io/
0 stars 6 forks source link

frozen Sonde(s) #120

Open d70-t opened 1 month ago

d70-t commented 1 month ago

With https://github.com/Geet-George/halodrops/commit/2c102ec8c53c52eaa3391dd45643d372176d9733, the Sonde class has been converted to a frozen dataclass. The reasoning behind this change is probably valid and I agree, that frozen could be a good design choice in this place. But then, immediately, there's a hot hack to escape the freezer using object.__setattr__, which essentially circumvents everything a dataclass provides. It's also hard to read and a bit unexpected to the casual Python reader.

In the meantime, this hack has spread quite a bit (as of now, I count 36 occurrences of object.__setattr__), so in fact, the Sonde is all but frozen, so it's a lie. We should get rid of this lie. Possible options are:

Geet-George commented 1 month ago

I agree. I had forgotten that I had it as a frozen dataclass. Of both options you suggest, I would prefer the latter (although the former is a quick change!). I'll see if I can get to this soon enough :/