Skip to content

Conversation

@sveinse
Copy link
Collaborator

@sveinse sveinse commented Apr 7, 2023

To create better distinction between the different Variable, Record and Array types used for different purposes. Helps development, as IDE/linters often only display base name of class. Discussed in issue #363

Unittests pass and generated sphinx documents have been skimmed over.

To create better distinction between the different Variable, Record and Array types used for different purposes. Helps development, as IDE/linters often only display base name of class.
Copy link
Member

@christiansandberg christiansandberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like a good improvement. As long as we keep backwards compatibility I see no problem.

@sveinse
Copy link
Collaborator Author

sveinse commented Apr 8, 2023

Updated with lastest commits in master.

Copy link
Member

@acolomb acolomb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good in principle, just a nit-pick about inconsistent uppercase variants.



class Variable(variable.Variable):
class PdoVariable(variable.Variable):
Copy link
Member

@acolomb acolomb May 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is pure bikeshedding, but why do you use CamelCase with the lowercase Pdo abbreviation here, while for the OD you use the all-caps OD spelling as in ODVariable? Should consistently use uppercase for abbreviations here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@acolomb you're right, this is inconsistent. I didn't make a very deliberate choice, rather trying to adopt the gist from the rest of canopen. After looking more closer at it, I see canopen is equally inconsistent, e.g. class PDO vs class PdoBase. Looking at all class names, the majority is CamelCase, with the notable exception of PDO, TPDO, RPDO and not used with an additional suffix.

To be consistent with naming in canopen, ODVariable should then be OdVariable perhaps?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I guess that's an acceptable solution. Just don't introduce even more inconsistency ;-)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naming is probably inconsistent everywhere else anyway, so it's not super important. Not sure what's best for readability, but I'm nowadays leaning more towards keeping abbreviations upper-case even if it makes it harder to separate the words.



class Record(Mapping):
class SdoRecord(Mapping):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, SDORecord? Please just be consistent.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With reference to comment above, SdoRecord is correct if SdoBase is correct I would argue.

@christiansandberg christiansandberg merged commit 0285f58 into canopen-python:master Sep 1, 2023
@sveinse sveinse deleted the feature-variable-rename branch April 26, 2024 01:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants