[Python-ideas] relaxing keyword usage restrictions

Mike Meyer mwm at mired.org
Mon Sep 5 07:18:40 CEST 2011


H Krishnan <hetchkay at gmail.com> wrote:

>Hi,
>
>Apologies if this has been asked already: why can't the usage of at
>least some keywords as identifiers be allowed with the context of the
>usage being used to identify if a keyword or a variable is being
>referred to.
>
>For example,
>
>if = 3  # if is identifier
>if if = 3: # first if is keyword, second if is identifer

By itself, enough to show this is a bad idea.

>While some of the usage may be confusing to the user, that is not for
>the language to dictate but for the user to choose.

Wrong. It's for the community to decide. The python community regularly decides to reject changes for no more reason than they might confuse a reader and provide no real benefit. Your examples show no benefit, and are obviously confusing.

However, there may be some merit to the basic idea. In particular, allowing class to be used as a method parameter has an obvious use case (class methods), and would not produce those confusing cases you used as examples.
-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.



More information about the Python-ideas mailing list