# Annotation-based sugar for ctypes

**URL:** <https://discuss.python.org/t/annotation-based-sugar-for-ctypes/26579>\
**Category:** Ideas\
**Created:** [May 7, 2023, 1:58pm UTC](https://discuss.python.org/t/annotation-based-sugar-for-ctypes/26579 "2023-05-07T13:58:51Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![vasily-v-ryabov](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/vasily-v-ryabov/32/10074_2.png) [@vasily-v-ryabov](https://discuss.python.org/u/vasily-v-ryabov)\
**Post date:** [May 20, 2023, 7:23am UTC](https://discuss.python.org/t/annotation-based-sugar-for-ctypes/26579/8 "2023-05-20T07:23:54Z")

</div>

The first suggestion about Structure looks somewhat normal to me, though making type hints valuable at runtime seems a little bit non-uniform with all other Python type hints which are not meaningful at runtime. Also there is a need to maintain both syntaxes and make them mutually exclusive, but it’s up to you.

But the second suggestion with decorator is very confusing. Please imagine if you are a newcomer and trying to understand why there is an empty function, maybe I need to remove it. 😉 Static analysis may decide something similar. And what if I add some implementation instead of pass statement? Will it be ignored?

Another argument against the decorator is that a dynamic library is pretty low level object, while a decorator is something at high level: it’s typically a transformation of decorated function, but you suggest something different and strange. I think it’s not worth it.

---

_[View the full topic](https://discuss.python.org/t/annotation-based-sugar-for-ctypes/26579)._
