[Python-ideas] Object grabbing

Steven D'Aprano steve at pearwood.info
Mon May 2 21:49:21 EDT 2016


On Tue, May 03, 2016 at 01:41:08AM +0000, Joshua Morton wrote:
> Right that makes sense. Is there any precedent for non-keywords being
> special cased by the compiler (I'm thinking specifically of Exceptions)?

For a while "as" was context sensitive, being treated as a keyword where 
necessary but still allowing you to use it as a variable name. In Python 
2.5:

py> import math as as
py> as
<stdin>:1: Warning: 'as' will become a reserved keyword in Python 2.6
<module 'math' from '/usr/local/lib/python2.5/lib-dynload/math.so'>

I believe that the core devs have sworn the most terrible and bloody 
oaths to never allow abominations like this again...

*wink*


-- 
Steve


More information about the Python-ideas mailing list