1

I'm a complete newbie to Python and I would like to know which option is better.

I'm talking about using all package and access to its names by "." and using a specific name from a package instead.

Perhaps my question will be considered stupid, but I'm really confused. I have seen a lot of examples where used full package import instead of importing a particular name.

For example, when I have to use only one name from a package, I would like to use the following code:

from y import x


use(x)

But so many examples use something like this:

import y

use(y.x)

Which option is correct in terms of PEP8? I think that importing a concrete name is going to be the best.

0 Answers0