On Thursday, March 17, 2016 at 12:25:36 PM UTC-5, Eric Snow wrote:

> So like Go does packages?  You should be able to do that
> using a custom loader and a path-entry finder to provide
> that loader.  See the importlib docs for more info.  Just
> be careful to only handle your special directories or else
> normal packages will break.

Yes, i had planned to do it in a manner that will exist side
by with the existing "official import mechanism". It's not
something i plan to do for "every single module". Only those
that have become "too large to easily edit".

> FWIW, there are more idiomatic ways to combine multiple
> files into a single module.  For instance, make a package
> containing your separate files but make the files private
> (leading underscore).  Then put "from XXX import *" for
> each of them.  If you want to limit what's exported from
> the package, either define __all__ in the sub-files or use
> "from XXX import YYY" in the package __init__.py.

Sure. That will allow me to "spread-out a large module's
source code into N smaller files", and then let Python
"combine the objects, defined in those multiple files, under
one monolithic namespace at run-time"... but i can't define
shared state between them *UNTIL* run-time -- at least, not
without resorting to "import spider webs" and monkey

I'm not trying to "define a module from N objects contained
in N source files", no, i'm trying to "define a *NAMESPACE*
from N source files". "N source files" that would
transparently share state just as though all the source
existed in the exact same file.

> As far as sharing a namespace between the sub-files, I'd
> recommend against an implicit mechanism (like Go does).
> I've found that it makes it harder to discover code.

Hmm, you're not the only person that has raised this issue.

I'm unaware of how Go handles namespaces, but i've used
other languages that *DO* offer a programmer the option of
"explicitly defining module namespace", and after writing
code for many years, I have not once encountered the issues
that you and others raise.

I'm speculating here, but it may be because i'm very OCD
about creating strong interfaces, and i avoid writing code
that rebinds symbols "in the shadows".  Of course, i'm not
suggesting that you, or anyone else, is incompetent, I'm
merely pondering, because it does sound like a legitimate

Hey, i can tell you from personal experience: there is
nothing worst than implementing a "grand idea", only to find
out later, that it was "fools gold". O:-)