Closed apiszcz closed 6 years ago
Let me suggest using enum (enumerations). This would take some doing, but I think it would accomplish this task without adding another function and do it in perhaps a more pythonic fashion. I don't really know if this will break things or not.
Also there is a backfill for versions lower than Python 3.4.
That would be useful I agree. Fixed it for now by adding a shapeTypeName readonly attribute for Shape, Reader, and Writer, dynamically reflecting the value in shapeType. See a664ad076549070a82cd6efb396b0c37e4ed7879.
Contemplating allowing setting by shapeTypeName, in the attribute as well as init, which might be more intuitive in some cases, and would allow immediate validation of the shapetype. But not fully sure since it would go against readability, using dynamic methods and a secret '_shapeType' in the background. Any thoughts @micahcochran or @apiszcz ?
Is there a shapeType to name function or attribute? I did not see one.
.shapeType .shapeTypeName ?