I've executed this from the Python REPL:
>>> ascii('Łukasz')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'ascii' is not defined
>>>
Why isn't a built-in function recognized?
The same thing happen when I executed this script with Python interpreter:
#!/user/bin/python
# -*- coding: UTF-8 -*-
def escape_unicode(f):
def wrap(*args, **kwargs):
x = f(*args, **kwargs)
return ascii(x)
return wrap
@escape_unicode
def my_name():
return 'Łukasz'
my_name()
NameError: global name 'ascii' is not defined
asciidoesn't exist in Python 2.7.