Language design

Ben Finney ben+python at benfinney.id.au
Wed Sep 11 19:19:58 EDT 2013


Mark Janssen <dreamingforward at gmail.com> writes:

> > * Imports are fiendishly complex, hidden below deceptively simple
> >   syntax.
> >
> >   It's a reasonable expectation that one can import a module from a
> >   source code file given its path on the filesystem, but this turns out
> >   to be much more complicated than in many other languages.
>
> Why is this so difficult?

I don't know, you'll have to ask the people who designed it that way.

> Add a Graph class to the collections module (networkx is quite good)
> and simply check for circular imports.

Er? That doesn't address the task of importing a module from a source
code file given its path on the filesystem.

Other languages have the equivalent of ‘include "/path/to/file.py"’, but
Python doesn't. That's the misdesign I'm describing.

-- 
 \      “Just because nobody complains doesn't mean all parachutes are |
  `\                                             perfect.” —Benny Hill |
_o__)                                                                  |
Ben Finney




More information about the Python-list mailing list