Attribute Docstrings and Annotations

Hello all, I was looking into function annotations, that are to be introduced in Python3k, and I found this old message sent to this mailing list : http://mail.python.org/pipermail/python-ideas/2007-January/000037.html I would like to restart the discussion of attribute annotation, because in my opinion it can be a very powerful feature. I personally think about using it for SOAP message serialization, or any kind of XML serialization, the Idea would be to annotate various object attribues to be either marshaled as XML Elements or XML Attributes of the current Node that reflects the Object. Thank you, -- Ali

On May 31, 2007, at 6:15 AM, Ali Sabil wrote:
Hi Ali, I'm afraid the PEP deadline has passed, restarting the discussion would not change that. Your use case sounds interesting. I know there are a lot of other use cases for attribute meta-data. However there are lots of ways to achieve attribute meta data storage. # Via naming convention class A: attr = 1 f_attr = int # Via decorators class A: attr = annotated_value(1, int) # Via a separate class class A: class meta: attr = int attr = 1 # Compare to attribute annotation syntax class A: attr: int = 1 Each of the existing idioms I have seen or used has issues, mostly minor. I suspect that because the existing ways don't have glaring deficiencies, even if it were before the PEP deadline, a renewed push on the proposal would have encountered a lot more resistance. I still think the syntax is elegant in symmetry and provides a unified and improved idiom for a common use case. -Tony

On May 31, 2007, at 6:15 AM, Ali Sabil wrote:
Hi Ali, I'm afraid the PEP deadline has passed, restarting the discussion would not change that. Your use case sounds interesting. I know there are a lot of other use cases for attribute meta-data. However there are lots of ways to achieve attribute meta data storage. # Via naming convention class A: attr = 1 f_attr = int # Via decorators class A: attr = annotated_value(1, int) # Via a separate class class A: class meta: attr = int attr = 1 # Compare to attribute annotation syntax class A: attr: int = 1 Each of the existing idioms I have seen or used has issues, mostly minor. I suspect that because the existing ways don't have glaring deficiencies, even if it were before the PEP deadline, a renewed push on the proposal would have encountered a lot more resistance. I still think the syntax is elegant in symmetry and provides a unified and improved idiom for a common use case. -Tony
participants (2)
-
Ali Sabil
-
Tony Lownds