Which of the best choice ?

John Hunter jdhunter at ace.bsd.uchicago.edu
Wed Nov 12 22:45:15 EST 2003


>>>>> "SungSoo," == SungSoo, Han <hanss at daetoo.com> writes:

    SungSoo> There are two coding style when python import module.
    SungSoo> (1) import sys (2) from import sys (or from import *)

    SungSoo> I prefer (1) style. Because it's easy to read,
    SungSoo> understand module in any category .


While 'from mod import *' can cause splitting headaches and devious
bugs, I love

   from mod import func

This allows me to easily replace functions with similar functionality
and signatures at the top level without having to search and replace
all the mod.func occurances in my code.

JDH





More information about the Python-list mailing list