-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New super #110
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #110 +/- ##
===========================================
- Coverage 89.55% 89.47% -0.09%
===========================================
Files 32 32
Lines 1944 1948 +4
===========================================
+ Hits 1741 1743 +2
- Misses 203 205 +2
Continue to review full report at Codecov.
|
Looks great @shimwell. I like the look of this solution. |
What do people think, is this a better way to do things. It avoids exposing the users to things they don't want or need. Any feedback welcome @RemiTheWarrior @bielsnohr @DeclanMorbey |
@shimwell That's super and it simplifies things for users (as well as the docs!) I reckon these can still be modified in the super class, right ? |
workplane="XZ", | ||
rotation_angle=360, | ||
solid=None, | ||
stp_filename="PoloidalFieldCoil.stp", | ||
color=None, | ||
azimuth_placement_angle=0, | ||
points=None, | ||
name=None, | ||
name='pf_coil', | ||
material_tag="pf_coil_mat", | ||
cut=None, | ||
hash_value=None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The alternative would be to collect these commonly unused arguments into a **kwargs
, set the defaults in a dictionary below, and loop through the passed argument to modify those in the default dictionary, which is passed to super.__init__()
Something like (this could definitely be more pythonic, but you get the idea)
default_dict = {...fill in}
for arg in kwargs:
if arg in default_dict:
default_dict[arg] = kwargs[arg]
super().__init__(...args you have..., **default_dict)
This leaves open the option to set these at initialisation, but encourages against their use unless absolutely necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestion much appreciated, we can give this a go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have added kwargs to see how it looks :-)
This can be closed now as the kwarg was implemented in #115 |
This is just an idea to see what can be done about removing some unused arguments from the user view