[Python-Dev] Assignment to None

Frank Wierzbicki fwierzbicki at gmail.com
Fri Jun 13 05:06:23 CEST 2008


On Wed, Jun 11, 2008 at 5:27 PM, Curt Hagenlocher <curt at hagenlocher.org> wrote:
> If I recall correctly, Jython handles this by appending a trailing
> underscore to the imported name and there's no reason why we couldn't
> do something similar.
In truth the current implementation of Jython allows keywords in many
strange places, I expect this was done to allow for method names that
are not keywords in Java so, for example, if there is a method called
"print" in a Java class that we want to call (quite common) then it
can be called.  As far as I know appended underscores don't enter into
it.  Some poking around reveals that the current Jython is probably
too lax here, even keywords that are common to both Python and Java
can be method names (like "if").  I plan to continue to allow Python
keywords that are not Java keywords to behave this way at least for
the 2.x series, though I don't think I'm going to go through the
effort of allowing keywords common to both Java and Python like "if"
(The 2.5 version of Jython will have a new parser so I do actually
need to make these explicit choices right now).  I think changing this
behavior would hurt backwards compatibility too much.  Maybe I'll
rethink it in our 3.0 timeframe.  If a convention like a trailing
underscore is adopted we might move to that in the move to 3.0.

-Frank


More information about the Python-Dev mailing list