I am trying to use collections.namedtupleto convert a dictionary to a python object.
import Zabbix
class Foo:
def bar(self):
collections.namedtuple('Zabbix.Request',['b','c'])
leading to a
ValueError: Type names and field names must be valid identifiers: 'Zabbix.Request'
My simple fix was to simply extend the inner class inside Foo
import Zabbix
class Foo:
class Request(Zabbix.Request):
pass
def bar(self):
collections.namedtuple('Request',['b','c'])
Is there a better way? Python 3.4 is currently in use
source
share