Skip to content

Conversation

@vlasovskikh
Copy link
Member

This this the follow-up to PR #874 with the non-controversial changes to object.

@matthiaskramm
Copy link
Contributor

Rerunning travis.

def __getattribute__(self, name: str) -> Any: ...
def __delattr__(self, name: str) -> None: ...
def __sizeof__(self) -> int: ...
def __reduce__(self) -> Union[str, tuple]: ...
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You used Union as a return type. In Mypy, this means that code that uses values returned from this method will trigger errors if the usage is valid for a single type only. This is why in general we're avoiding using Unions as return values.

Is this intended, @vlasovskikh?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ambv You're right. object.__reduce__ always returns a tuple unless it's overridden in inheritors. So inheritors are free to specify str or tuple or a specific tuple as the actual return type of the override.

It's up to its inheritors to return either a tuple or a string.
@ambv ambv merged commit 295788b into python:master Feb 20, 2017
@vlasovskikh vlasovskikh deleted the vlan/object-special-attributes branch February 20, 2017 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants