-
Notifications
You must be signed in to change notification settings - Fork 178
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
'import *' is not a recommended practice #114
Comments
Yeah, in other Python code I write, I'd definitely frown on If I were using SP in part of a bigger program with the geometry as a separate feature, I'd likely # From examples, at https://github.com/SolidCode/SolidPython/blob/master/solid/examples/basic_geometry.py
from solid import *
left_piece = union()(
translate([-15, 0, 0])(
cube([10, 5, 3], center=True)
),
translate([-10, 0, 0])(
difference()(
cylinder(r=5, h=15, center=True),
cylinder(r=4, h=16, center=True)
)
)
) And see this with the recommended python import style: # With namespaced import
import solid as sp
left_piece = sp.union()(
sp.translate([-15, 0, 0])(
sp.cube([10, 5, 3], center=True)
),
sp.translate([-10, 0, 0])(
sp.difference()(
sp.cylinder(r=5, h=15, center=True),
sp.cylinder(r=4, h=16, center=True)
)
)
) To my mind, the code in the first snippet is a lot clearer. Do you disagree? |
I see and completely understand your point. If this is the reason for suggesting In all honesty I just started playing with this library so I'm not a long time user. However I've already found some downfalls to that practice such as having to name the function Anyway, I see your point. I guess it is not such an easy trade-off. |
Documentation tells the user to use
from solid import *
. Which a practice that is currently discouraged [1][2]. Am I missing some good reasoning for doing this? Otherwise, would you accept a PR in the lines of suggesting something likeimport solid as sp
?The text was updated successfully, but these errors were encountered: