py: Allow retrieving a function's __name__.

Disabled by default.  Enabled on unix and stmhal ports.
This commit is contained in:
stijn
2015-02-14 18:44:31 +01:00
committed by Damien George
parent 07b8dc68d6
commit 3cc17c69ff
9 changed files with 54 additions and 8 deletions

16
tests/basics/fun_name.py Normal file
View File

@@ -0,0 +1,16 @@
def Fun():
pass
class A:
def __init__(self):
pass
def Fun(self):
pass
try:
print(Fun.__name__)
print(A.__init__.__name__)
print(A.Fun.__name__)
print(A().Fun.__name__)
except AttributeError:
print('SKIP')