Raymond Hettinger <[email protected]> added the comment:
> but can we do the same thing with the PyGetSetDef declaration
> for the C Part?
The would likely take an API change. For now, using only what is already
exposed in Python, we can only partition data descriptors in two groups:
* Known to be readonly because __set__ is missing or fset is None
* Possibly writeable, can't really tell until __set__ is called
Example in the latter category,
>>> t = time.localtime()
>>> hasattr(type(t).tm_sec, '__set__')
True
>>> t.tm_sec = 31
Traceback (most recent call last):
File "<pyshell#23>", line 1, in <module>
t.tm_sec = 31
AttributeError: readonly attribute
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue36401>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com