8000 Add partial.__new__ by NeilGirdhar · Pull Request #6813 · python/typeshed · GitHub
[go: up one dir, main page]

Skip to content

Add partial.__new__ #6813

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 4, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add partial.__new__; remove partial.__init__
* Add partial.__new__: __new__ is necessary for any derived classes that
  override __new__ and want to call super since new instead of init is
  defined in the base class.
* Remove partial.__init__ since it's not defined.
* Make the func parameter positional-only by naming it with
  double-underscore, as per PEP 484.
  • Loading branch information
NeilGirdhar committed Jan 4, 2022
commit 6e2afde8c9356fb156351bd93cc509e815542852
2 changes: 1 addition & 1 deletion stdlib/functools.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class partial(Generic[_T]):
func: Callable[..., _T]
args: tuple[Any, ...]
keywords: dict[str, Any]
def __init__(self, func: Callable[..., _T], *args: Any, **kwargs: Any) -> None: ...
def __new__(cls: Type[_S], __func: Callable[..., _T], *args: Any, **kwargs: Any) -> _S: ...
def __call__(self, *args: Any, **kwargs: Any) -> _T: ...
if sys.version_info >= (3, 9):
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
Expand Down
0