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 like the lessons that are developing here a lot!
So in the section on expressive code there are a lot of good ideas about naming, and right near the end it seems like there is a really nice spot to do a super brief spot about expressiveness in package structure.
What i'm thinking is something like
in the same way that you group related operations into a function, you can think of a python module as a grouping of related functions, and a package is a nested grouping of modules.
you can use the structure of your package to communicate meaning as well
(i.e. the temperature.conversion.f_to_k/fahrenheit_to_kelvin example)
your package structure and names can help someone know how to use your package
_private variable names indicate when something is an implementation detail they shouldn't use
importing objects from modules into a namespace and using __all__ = [] is another way to signal which things are intended to be used, and a way for you to signal relative importance/commonness - eg. pandas imports all their user-facing functions to the top level so you can do stuff like pd.to_datetime instead of needing to do pandas.core.api.to_datetime or pandas.core.tools.datetimes.to_datetime.
The text was updated successfully, but these errors were encountered:
Continuing a thought here: #44 (comment)
I like the lessons that are developing here a lot!
So in the section on expressive code there are a lot of good ideas about naming, and right near the end it seems like there is a really nice spot to do a super brief spot about expressiveness in package structure.
What i'm thinking is something like
temperature.conversion.f_to_k
/fahrenheit_to_kelvin
example)_private
variable names indicate when something is an implementation detail they shouldn't use__all__ = []
is another way to signal which things are intended to be used, and a way for you to signal relative importance/commonness - eg. pandas imports all their user-facing functions to the top level so you can do stuff likepd.to_datetime
instead of needing to dopandas.core.api.to_datetime
orpandas.core.tools.datetimes.to_datetime
.The text was updated successfully, but these errors were encountered: