| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Use _ssl._SSLContext.check_hostname as the main example.
Documentation build overview2 files changed ± versions/index.html ± development-tools/clinic/howto/index.html |
Sorry, something went wrong.
| The value is only converted if the attribute is not deleted, so it must have | ||
| a default value, which the "impl" function receives for the deletion. | ||
| The implicitly declared value gets the default ``NULL``. |
There was a problem hiding this comment.
IMO, this is too confusing. The connection between default and placeholder for del is not obvious.
An if (value=NULL) inside the function covers all the use cases and is much clearer. Can we disallow arbirtary defaults (or enforce using NULL) here?
Sorry, something went wrong.
There was a problem hiding this comment.
If we use converter such as int, we cannot use if (value=NULL) inside the function. For now, there are no such examples in the CPython code, but we can add them in future.
If deletion is equivalent to setting to None or other value, we can use it as the default value and remove a special case from function. For now there are no examples which do not store NULL internally.
So practically all current examples use NULL as default value. But adding additional restriction on the default value will only complicate the code and unnecessary restrict the future use.
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Documents the changes in python/cpython#156066, and should be merged after it.
The value of a @setter can be declared as a parameter with a converter, and a @getter can define a return converter.
The accessors of an attribute are now identified by its Python name, so they can use different C basenames and can be defined several times in mutually exclusive preprocessor conditional blocks.
_ssl._SSLContext.check_hostname is used as the main example instead of _io.TextIOWrapper._CHUNK_SIZE, because it uses converters, and function.__type_params__ is used as the example of @deleter.