[Python-ideas] relaxing keyword usage restrictions

Devin Jeanpierre jeanpierreda at gmail.com
Wed Sep 7 15:40:39 CEST 2011


On Tue, Sep 6, 2011 at 9:01 PM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> 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'

I seem to remember them being banned for all use in Python
forever, but backticks are used for a similar purpose in SQL without
ambiguity.

    `blarg baz` = 3
    `foo`[`blarg baz`] = `asdf`

I'd definitely prefer them to overloaded quotes.

Devin



More information about the Python-ideas mailing list