PyWart: Import resolution order

Chris Angelico rosuav at gmail.com
Fri Jan 11 07:30:27 CET 2013


On Fri, Jan 11, 2013 at 5:13 PM, Rick Johnson
<rantingrickjohnson at gmail.com> wrote:
> The fact that Python looks in the stdlib _first_ is not a good idea. It would seem more intuitive for a custom "math" module (living in the current directory) to /override/ the stlib "math" module. The proper order is as follows:
>
> 1. Current package or directory
> 2. stdlib
> 3. under the bed
> 4. who cares at this point

Why is it better to import from the current directory first? Windows
has that policy for executable commands; Unix, on the other hand,
requires that you put an explicit path for anything that isn't in the
standard search path. Which of these options is the more likely to
produce security holes and/or unexpected behaviour?

Welcome back to the list, Rick. Got any demonstrable code for Python 4000 yet?

ChrisA



More information about the Python-list mailing list