Message282904
> You propose an automatic conversion of "None" into "-1"? That's awful. Please don't commit that patch to CPython.
Not really, I propose a way to do it with AC when needed. And the AC semantics introduced are not "Automatic conversion of None into -1" but "automatic "don't touch the C default" when the python default is given", so it's reusable for other values:
something: Py_ssize_t(c_default="-1") = None
something: Py_ssize_t(c_default="0") = None
something: Py_ssize_t(c_default="42") = None
…
And this semantic can be extended to other types too if needed:
something: a_type(c_default="a_c_side_default_value") = None
To get "a_c_side_default_value" when None is given.
I however did not introduced a way to keep the C default value by using something else than None in the Python side:
- I'm not sure this is usefull to allow it but it can still be implemented if needed
- Limiting to None permits to keep a type check so ``something: Py_ssize_t(c_default="-1") = "bar"`` will still fail at clinic.py runtime. |
|
Date |
User |
Action |
Args |
2016-12-11 05:24:04 | mdk | set | recipients:
+ mdk, larry |
2016-12-11 05:24:04 | mdk | set | messageid: <1481433844.2.0.727759567171.issue28933@psf.upfronthosting.co.za> |
2016-12-11 05:24:04 | mdk | link | issue28933 messages |
2016-12-11 05:24:03 | mdk | create | |
|