I have written an xsd parser to generate python classes. I also have written a utility to read in an xml file to populate the python classes.
As well as a utility to write xml from the python classes thus generated.
For example the code below that I include here shows a small sample of the generated code.
The __annotations__ for these are very easy to use by the utility code for doing their job.
Using the typing list[x] and tuple[a,b] do not work as well as
- [x] instead of list[x]
- (a, b) instead of tuple(a, b)
I seem to feel list[x] and tuple[a,b] are far more non Python, requiring having to parse the string they return in a complicated way.
Looping through the annotations to get the field types it's easy to test for list or tuple and then get the field type for the list or tuple and the usage for the tuple.
I have been using Python from version 1.6 and have been involved in writing and generating tons of lines of Python.
ATTRIB, PSEUDO, ASIS = range(3)
self.isNew = ''
self.whizz = ''
self.column = ''
self.record = 
rt = RecordType()
for annote in rt.__annotations__:
print (annote, type(rt.__annotations__[annote]))
mtt = MsgTableType()
for annote in mtt.__annotations__:
print (annote, type(mtt.__annotations__[annote]))