Which of the best choice ?

Terry Reedy tjreedy at udel.edu
Wed Nov 12 16:55:24 EST 2003


"SungSoo, Han" <hanss at daetoo.com> wrote in message
news:e1ec42ca.0311111554.7433e56 at posting.google.com...
> There are two coding style when python import module.
>  (1) import sys
>  (2) from import sys (or from import *)
>
> I prefer (1) style. Because it's easy to read, understand module in
any category

In some situations, I like a third choice: import math as m, for
instance.  (But I would not bother to abbreviate 'sys'.)  Typing 'm.'
as in 'm.sin' is quick and a small price for keeping math names
segregated.

TJR






More information about the Python-list mailing list