
On Thu, Dec 18, 2003 at 02:16:45PM +1100, Andrew Bennetts wrote:
On Wed, Dec 17, 2003 at 10:08:21PM -0500, Barry Warsaw wrote:
On Wed, 2003-12-17 at 22:04, Andrew Bennetts wrote:
On Wed, Dec 17, 2003 at 09:33:43PM -0500, Barry Warsaw wrote:
That's why when I tend to think about this, I start wanting a way to spell "definitely give me the global one, no matter what". IOW, I feel like I want a way to bypass relative module lookups.
Alternatively, maybe what you want is a way to say "definitely give me the standard library one, no matter what", e.g.
from stdlib import codecs
Interesting. I see the subtle distinction. One searches only the standard library, the other searches every directory on sys.path. I'm not sure I'd have much need to restrict the search to just the standard library. Plus, would that include site-packages?
I should have been clearer. What I'm basically proposing is to make site-package called "stdlib", leaving a default python install with a very uncluttered top-level namespace, thus reducing unexpected name conflicts.
I'm at least a little confused with what people want, as far as I can tell import semantics have three things * what module to import * what name to give that import * where to look for it The 'from' keyword seems to be getting overloaded to mean both what module and where to find it, which the 'stdlib' tries to resolve. Most of the discussion has been about how to improve 'where to look' I like syntax that reads most important left-to-right, so what about from MODULE import NAMES as RENAME searching HOW or import NAMES as RENAME from MODULE searching HOW searching could be 'asbolute' 'relative' or any of the other suggested words. If you wanted to get fancy it could be a list, if it isn't a list people who truly care could cascade try/except on ImportError. -jackdied ps, I like the second version better but it is less like the current version, which is a drawback.