New submission from Jonas Wielicki:

Assume I have this code:

class Spam:
    def eggs(__some_kwarg:int=None):
        print(__some_kwarg)

I can call Spam.bar with keyword arguments as expected from mangling:

>>> Spam.eggs(10)
10
>>> Spam.eggs(_Spam__some_kwarg=10)
10

However, in the __annotations__ field, the argument name is not mangled:

>>> Spam.eggs.__annotations__
{'__some_kwarg': <class 'int'>}

This is an inconsistency which makes it difficult to work with function 
annotations in this case.

----------
components: Interpreter Core
messages: 211215
nosy: jonasw
priority: normal
severity: normal
status: open
title: Argument names in __annotations__ are not mangled for functions defined 
inside class scope
type: behavior
versions: Python 3.3

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue20625>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to