nested scopes

John Schmitt jschmitt at vmlabs.com
Tue Feb 6 07:42:29 CET 2001


> -----Original Message-----
> From: Nathaniel Gray [mailto:n8gray at caltech.edu.is.my.email.address]
> Sent: Monday, February 05, 2001 2:02 AM
> To: python-list at python.org
> Subject: RE: nested scopes
[snip]
> telling the compiler that only names beginning with "tb" are 
> imported.  
> This way you could still design libraries to use from ... import ..* 
> without totally throwing efficiency out the window.  I know 
> import * is 
> considered harmful, but occasionally (think tkinter) it's a useful 
> construct, assuming the library is designed to prevent name conflicts.
[snip]

When I first picked up Python, I typed in a couple of examples from
Grayson's book.  I would always say:

import Tkinter
tk = Tkinter
root = tk.Tk()
# etc

I tacked on a 'tk.' in front of tk calls.  I wanted to know which function
came from tk and which came from the standard python library etc. 

For what it's worth, I'd like to say that I'm happy that from ... import..*
is discouraged and if it disappeard from the language completely, I wouldn't
miss it.  Only slightly related is the fact anything that looks like
Pascal's 'with' would be completely wasted on me. :-)   I'd rather prepend
class name.  Explicit is better than implicit, right?

John




More information about the Python-list mailing list