[chirp_devel] Naming convention for class fields?

Craig Jones
Mon May 15 16:05:42 PDT 2023


I'm looking over the yaesu_clone superclass with FT1D subclass as a 
suggested example. I'm confused by the conflicting naming conventions. 
In yaesu_clone.py line 231 the superclass begins with these class fields:

VENDOR="Yaesu"
NEEDS_COMPAT_SERIAL=False
     _model =b"ABCDE"

Why are the first two all caps, but the third is lowercase with a 
leading underscore? Is this documented somewhere that I missed?

Normally, a leading underscore means the variable is local to the 
current scope and shouldn't be accessed outside of it. But in this case, 
VENDOR and _model are both overridden in the subclass. I didn't think 
that a subclass still counts as local. Also, normally all caps means 
it's a constant. Yet, again, the VENDOR gets overridden. So, to my mind 
all of these variables should be lowercase with no leading underscore. 
Just "vendor", just "model". (Or, leading underscores with corresponding 
@property accessors.)

(signed) Confused in Las Vegas 😮




-- 
This email has been checked for viruses by AVG antivirus software.
www.avg.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://intrepid.danplanet.com/pipermail/chirp_devel/attachments/20230515/ee3ef08a/attachment-0001.html 


More information about the chirp_devel mailing list