Re: Konstanten in Struct-Form in Python

Hartmut Goebel <[email protected]>
Newsgroups gmane.comp.python.general.german
Organization crazy-compilers.com
Message-ID <[email protected]>
Am 19.02.21 um 15:27 schrieb Michael S.:
> Was mich dran nervt ist, dass jede einzelne CAN-Botschaft eine eigene 
> Klasse ist und ich die im Code erstmal instanzieren muss, bevor ich 
> sie nutzen kann. Das muss doch auch einfacher gehen
Mache Klassen-Variabblen draus:

class CAN_AC_Voltage:
     ID = 0x16FC8B11
     BitOffset = 48
     BitLength = 8
     Gain = 1
     ValueOffset = 0
     Unit = "V"
     Rate = 0.5

-- 
Regards
Hartmut Goebel

| Hartmut Goebel          | [email protected]               |
| www.crazy-compilers.com | compilers which you thought are impossible |

_______________________________________________
python-de maillist  -  [email protected]
https://mail.python.org/mailman/listinfo/python-de
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.