I've seen Python objects with attributes like %values
. I can't access such attributes, as they raise a SyntaxError
. They also seem to require setattr
to be created without a SyntaxError
:
class A(object):
pass
a = A()
setattr(a, "%values", 42)
a.%values # results in SyntaxError: invalid syntax
class B(object):
def __init__(self):
self.%values = 42 # results in SyntaxError: invalid syntax
Does the %
have any purpose or meaning here? Why can %values
be set using setattr
, but otherwise raises a SyntaxError
?