Antoine Pitrou wrote: > Nick Coghlan <ncoghlan <at> gmail.com> writes: >> The problem is that having '' as the first entry in sys.path currently >> means "do the import relative to the current directory". Unless we want >> to change the language semantics so we stick os.getcwd() at the front >> instead of '', then __file__ is still going to be relative sometimes. > > "Changing the language semantics" is actually what I was thinking about :) > Do some people actually rely on the fact that changing the current directory > will also change the import path?
I've learned that no matter how insane our current semantics for something may be, someone, somewhere will be relying on them :) In this case, the current semantics aren't even all that insane. A bit odd maybe, but not insane. I think they're even documented, but I couldn't say exactly where without some digging. I think we also use the trick of checking for an empty string in sys.path[0] in a couple of places before deciding whether or not to remove it (I seem to recall applying a patch to pydoc along those lines so it worked properly with the -m switch). Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia --------------------------------------------------------------- _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com