[issue26565] [ctypes] Add value attribute to non basic pointers.

Memeplex report at bugs.python.org
Sat Jun 11 16:10:02 EDT 2016


Memeplex added the comment:

Martin, there were two reasons:

1. Conciseness: addressof(p.contents) vs. p.value.
2. Uniformity: I expect the value of a pointer to be the address it points to.

Then Eryk pointed out that p.value has already another meaning for simple pointer types, so (2) can't be fully achieved and for (1) it will be necessary to pick another attribute name. But we could still get something shorter and uniform inside the subset of pointer types.

p.as_void makes me expect a c_void_p instance. In that case the address will be p.as_void.value (or p.as_void().value?), which is a bit indirect. I think p.toaddress conveys the exact meaning[1] and consistently follows the naming style of addressof, besides being slightly shorter.


[1] Well, toaddress might mean "get the pointed-to address" or "convert from pointer to address", but in any case the meaning is right.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26565>
_______________________________________


More information about the Python-bugs-list mailing list