Friday, 15 June 2012

python - Importing a module and using its methods -


I'm looking at a snippet of code and I do not understand how it works:

P>

If the first line imports all the piegages, then we have to import a subset of modules specially? Why not only import work in the first place?

the only import will be sufficient, but the author has pygame For example, instead of:

  import pygame ... resolution = pygame.locals.TIMER_RESOLUTION  
for example, to the constants of

It will sometimes be better

Import from pygame.locals ... * Resolve = TIMER_RESOLUTION

Note that you are now Should also import pygame other methods / properties of pygame ( pygame.locals. In addition to access).


No comments:

Post a Comment