You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've read the book Clean Python: Elegant Coding in Python by Sunil Kapil. The author describes a lot of interesting things to improve the code. I would like to discuss one idea.
In chapter 3. Writing Better Functions and Classes, the author recommends:
Class Structure
I prefer a class structure in this order:
Class variables
__init__
Built-in Python special methods (__call__, __repr__, etc.)
Class methods
Static methods
Properties
Instance methods
Private methods
Probably there are other ways to group the content of classes, but it makes sense to me.
After looking at src/semver/version.py, the methods in the Version class looks a bit disorganized to me. So I'm tempted to group them according to Kapil's scheme. There are no feature changes, only lines that are moved around.
As we only have one open pull request (which belongs to me anyway) I think it would be small risk to take. I can't think of any downside right now.
Release_3.x.yOnly for the major release 3EnhancementNot a bug, but increases or improves in value, quality, desirability, or attractiveness
1 participant
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I've read the book Clean Python: Elegant Coding in Python by Sunil Kapil. The author describes a lot of interesting things to improve the code. I would like to discuss one idea.
In chapter 3. Writing Better Functions and Classes, the author recommends:
Probably there are other ways to group the content of classes, but it makes sense to me.
After looking at
src/semver/version.py
, the methods in theVersion
class looks a bit disorganized to me. So I'm tempted to group them according to Kapil's scheme. There are no feature changes, only lines that are moved around.As we only have one open pull request (which belongs to me anyway) I think it would be small risk to take. I can't think of any downside right now.
Any concerns?
Beta Was this translation helpful? Give feedback.
All reactions