Request for feedback on my first Python program
Mel Wilson
mwilson at the-wire.com
Sat May 31 07:57:29 EDT 2003
In article <MPG.19419ac796796a739896f2 at news.hevanet.com>,
Scott Meyers <Usenet at aristeia.com> wrote:
> - Is it better to get into the habit of (a) importing modules and using
> fully qualified names or (b) importing selective names from modules and
> using them without qualification? That is, which is generally better?
>
> import sys # a
> sys.exit(1)
This is generally better, unless the fully qualified name
gets ridiculously long. B is vulnerable to
> from sys import exit # b
... 1000 lines of code ...
def exit (something):
... some code ...
... 1000 more lines of code ...
> exit(1)
I doubt that anyone would actually do this with exit, but
something less well knows could be covered up this way. Of
course, nothing actually prevents `sys = 17` and its
consequences, either.
Regards. Mel.
More information about the Python-list
mailing list