New GitHub issue #118710 from abacabadabacaba:<br>
<hr>
<pre>
### Proposal:
Sometimes, when there is a function that can operate both on IPv4 and IPv6 addresses, it is convenient to pass it the corresponding type object (either `IPv4Address` or `IPv6Address`) as an argument. However, that function cannot access the properties `version` and `max_prefixlen` using those type objects, because they only work on instances. This can be worked around by constructing a dummy instance (e.g. `t(0).max_prefixlen`), but it would be more convenient if those properties could be used on the type object directly (i.e. `t.max_prefixlen`), because their value doesn't depend on the specific instance, only on the type.
The proposal is to make `IPv4Address.version`, `IPv4Address.max_prefixlen`, `IPv6Address.version`, and `IPv6Address.max_prefixlen` evaluate to 4, 32, 6, and 128, respectively. Currently, all those expressions evaluate to property descriptors.
### Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
### Links to previous discussion of this feature:
_No response_
</pre>
<hr>
<a href="https://github.com/python/cpython/issues/118710">View on GitHub</a>
<p>Labels: type-feature</p>
<p>Assignee: </p>