[Python-ideas] relaxing keyword usage restrictions

Greg Ewing greg.ewing at canterbury.ac.nz
Wed Sep 7 03:01:47 CEST 2011


Nick Coghlan wrote:

> class Foo:
>   normal = 1
>   'class' = 'This is probably a terrible idea'
>   '1234' = 'as is this'
>   'or does it' = 'have some merit?'

Could be rather confusing, since the interpretation of a string
literal would depend somewhat subtly on its position in an
expression. And it's not just a LHS/RHS distinction, because
presumably the following would still parse with all the string
literals being literals... or would it?

   'foo'['blarg'] = 'asdf'

-- 
Greg



More information about the Python-ideas mailing list