[Python-ideas] Verbatim names (allowing keywords as names)

Andrés Delfino adelfino at gmail.com
Wed May 16 09:05:33 EDT 2018


IMHO, it would be much easier to learn and understand if keywords can only
be used by escaping them, instead of depending where they occur.

On Wed, May 16, 2018 at 9:13 AM, Wolfgang Maier <
wolfgang.maier at biologie.uni-freiburg.de> wrote:

> On 16.05.2018 02:41, Steven D'Aprano wrote:
>
>>
>> Some examples:
>>
>>      result = \except + 1
>>
>>      result = something.\except
>>
>>      result = \except.\finally
>>
>>
> Maybe that could get combined with Guido's original suggestion by making
> the \ optional after a .?
>
> Example:
>
> class A ():
>     \global = 'Hello'
>     def __init__(self):
>         self.except = 0
>
>     def \finally(self):
>         return 'bye'
>
> print(A.global)
> a = A()
> a.except += 1
> print(a.finally())
>
> or with a module, in my_module.py:
>
> \except = 0
>
> elsewhere:
>
> import my_module
> print(my_module.except)
>
> or
>
> from my_module import \except
> print(\except)
>
> Best,
> Wolfgang
>
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180516/c01b6eae/attachment.html>


More information about the Python-ideas mailing list