On Wed, Apr 9, 2014 at 7:17 AM, <uga...@talktalk.net> wrote: > Is it common for files saved to a working directory to 'mask' library files > located in the Python framework?
Hi ugajin, To come back to your original question: yes, unfortunately this happens. I think it's a flaw in the language. There are steps to mitigate the problem, some by convention, some by using newer features in Python. Certain style guidelines dictate that module import never use relative paths, but rather use one rooted at the toplevel package directory. As a concrete example, see Google Python style guidelines on how to do imports: http://google-styleguide.googlecode.com/svn/trunk/pyguide.html#Packages This is odd at first, but it has the intent of avoiding module collision. The basic idea is to have all your code packaged, and always use the unique package as a namespace to avoid collision with the standard library. So if you have modules m1, m2 in package p, and m1 wants to import m2, then we say: import p.m2 Other mitigation strategies include using explicit-relative imports: https://docs.python.org/2/tutorial/modules.html#intra-package-references but I think the convention approach is a little easier to handle. _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor