Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #96262 > unrolled thread

Re: Question about import

Started byPeter Otten <__peter__@web.de>
First post2015-09-10 16:47 +0200
Last post2015-09-10 16:47 +0200
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Question about import Peter Otten <__peter__@web.de> - 2015-09-10 16:47 +0200

#96262 — Re: Question about import

FromPeter Otten <__peter__@web.de>
Date2015-09-10 16:47 +0200
SubjectRe: Question about import
Message-ID<mailman.319.1441896793.8327.python-list@python.org>
Ian Kelly wrote:

> On Thu, Sep 10, 2015 at 1:12 AM, Frank Millman <frank@chagford.com> wrote:
>> That makes me wonder if, in my project, I can import all modules inside
>> 'start.py', and then just use 'import package_name' inside each module?
> 
> You can, but for readability and reuse I think it's better to be
> explicit in each module and import the fully qualified module names
> that are needed, rather than relying on some other module to import
> them for you.
> 
>> Another question - I thought that, because aa.py and bb.py are in
>> different sub-directories, I would have to set them up as packages by
>> adding '__init__.py' to each one, but it works fine without that. What am
>> I missing?
> 
> That surprises me also, but I suspect it's because they're
> subdirectories of the current working directory rather than packages
> found on the sys.path.

So even the experts cannot keep up with all those nifty new features:

https://www.python.org/dev/peps/pep-0420/ (Implicit Namespace Packages)

I'm waiting to see the language collapse under all its nice and -- seen in 
isolation -- incredibly useful additions. 

C++ we're coming :(

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web