[Python-Dev] Import semantics

Samuele Pedroni pedronis at strakt.com
Mon Jun 12 21:20:53 CEST 2006


Bill Janssen wrote:
>>the difference in Jython is deliberate. I think the reason was to mimic 
>>more the Java style for this, in java fully qualified names always work. 
>>In jython importing the top level packages is enough to get a similar 
>>effect.
>>
>>This is unlikely to change for backward compatibility reasons, at least 
>>from my POV.
> 
> 
> While I appreciate the usage concerns, at some point someone has to
> decide whether Jython is an implementation of Python, or a version of
> BeanShell with odd syntax. 

this is mildy insulting, to the people that spent time trying to find 
the best compromises between various issues and keep jython alive.
For example, I spent quite some energy at times to justify not 
implementing some unpythonic but tempting features from a java pov.

> If it's Python, it has to comply with the
> Python specification, regardless of what Java does.  

cpython cannot import java packages. also python rules don't translate
completely to them, and sometimes python import semantics are as clear 
as mud and reading import.c is the only way to know. Of course allowing 
this for python packages was an overgeneralisation.

> If it doesn't do
> that, it should be cast into the outer darkness of the Python world.
> 

this is a design decision that originates back to Jim. It could be 
limited maybe to java packages, but is sadly quite addictive.
That's why I mentionted a backward compatibility problem.


> The escape hatch here would be to redefine the Python specification to
> allow either behavior.
> 
> Bill



More information about the Python-Dev mailing list