In this class:
class message:
def __init__(self, node_info = None):
if node_info is None: node_info = []
self.node_info = node_info
@property
def node_info(self):
return self._node_info
@node_info.setter
def node_info(self, value):
self._node_info = value
node_info should have a layout similar to this:
sample_node_info = [
'Node Name',
'Node URL',
status,
['Service1','ServiceURL1',status],
['Service2','ServiceURL2',status]
]
The first two elements are strings, and are required. Subsequent elements are lists, and are optional. The optional elements, if included, should contain three required elements:
service_info = ['ServiceName','ServiceURL',status]
Question: How do I validate node_info against this format in the class above? Do I have to parse the list or is there some better way, like defining a schema/format of some sorts?