When would you import a function using from versus importing a library using the import statement?
Inconsistant verb forms:
"import a function using from versus"
"importing a library using the import"
"importing" --> "import"
Or better yet, you could drop "import a library using" altogether:
When would you import a function using from versus the import statement?
If you are using a couple of attributes of a library, perhaps you might want to use a from style import.
If you are only using a couple of attributes of a from a library, perhaps you might want to use a the from style import.
If you are only using a couple attributes from a library, you might want to use the from style import.
If you need access to most of the library, it is less typing to import the library.
More explicit:
However if you need to access to most of the library, it is requires less typing to import the library using the import statement.
However if you need to access most of the library, it requires less typing to import the library using the import statement.
It is also a hint to you as a programmer, where the function (or class or variable) came from.
It is also a hint to you as a programmer anyone reading your code (including you), as to where the function (or class or variable) came from.
It is also a hint to anyone reading your code (including you), as to where the function (or class or variable) came from.
Altogether:
When would you import a function using from versus the import statement? If you are only using a couple attributes from a library, you might want to use the from style import. It is possible to specify multiple comma-delimited attributes in the from construct:
-and-
However if you need to access most of the library, it requires less typing to import the library using the import statement. It is also a hint to anyone reading your code (including you), as to where the function (or class or variable) came from.
Inconsistant verb forms:
"import a function using
from
versus" "importing a library using theimport
""importing" --> "import"
Or better yet, you could drop "import a library using" altogether:
When would you import a function using
from
versus theimport
statement?If you are only using a couple
ofattributesof afrom a library,perhapsyou might want to useathefrom
style import.If you are only using a couple attributes from a library, you might want to use the
from
style import.More explicit: However if you need to access
tomost of the library, itisrequires less typing to import the library using theimport
statement.However if you need to access most of the library, it requires less typing to import the library using the
import
statement.It is also a hint to
you as a programmeranyone reading your code (including you), as to where the function (or class or variable) came from.It is also a hint to anyone reading your code (including you), as to where the function (or class or variable) came from.
Altogether:
When would you import a function using
from
versus theimport
statement? If you are only using a couple attributes from a library, you might want to use thefrom
style import. It is possible to specify multiple comma-delimited attributes in the from construct:-and-
However if you need to access most of the library, it requires less typing to import the library using the
import
statement. It is also a hint to anyone reading your code (including you), as to where the function (or class or variable) came from.