Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added draft chapter to typing spec for constructors. (#1667)
* Added draft chapter to typing spec for constructors. * Update docs/spec/constructors.rst Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> * Update docs/spec/constructors.rst Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> * Update docs/spec/constructors.rst Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> * Added section on signature consistency between `__new__` and `__init__`. * Incorporated PR feedback. * Added clarification based on question in forum. * Incorporated feedback about callable conversion. Clarified behaviors when a class doesn't inherit a `__new__` or `__init__` from a class other than `object`. * Tweaked the spec based on Jelle's feedback about a `__new__` method that returns `Any`. Also clarified what happens when a call to `__call__` or `__new__` evaluates to a union type. * Updated handling of `Any` return types for `__call__` and `__new__` methods to reflect suggestion from @rchen152 in [this post](https://discuss.python.org/t/draft-typing-spec-chapter-for-constructors/49744/22). * Incorporated feedback from @gvanrossum. --------- Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
- Loading branch information