◐ Shell
reader mode source ↗
Skip to content

Prohibit Callable[[...], X]#320

Merged
gvanrossum merged 6 commits into
python:masterfrom
ilevkivskyi:fix-callable
Nov 7, 2016
Merged

Prohibit Callable[[...], X]#320
gvanrossum merged 6 commits into
python:masterfrom
ilevkivskyi:fix-callable

Conversation

@ilevkivskyi

@ilevkivskyi ilevkivskyi commented Nov 6, 2016

Copy link
Copy Markdown
Member

@gvanrossum
Now Callable[[...], X] is accepted and treated as equivalent to Callable[..., X] (also Callable[[()], X] is treated as equivalent to Callable[[], X]). PEP 484 does not specify the former forms, so that this PR makes them prohibited.

I do not have any preference on this, so please feel free to either merge or close this.

@gvanrossum

Copy link
Copy Markdown
Member

Strange that was ever accepted. Was this aways there? I don't recall intending to support this.

@ilevkivskyi

Copy link
Copy Markdown
Member Author

@gvanrossum It look like it was introduced in #308 when I split __getitem__ in two parts, so that it could be cached. So that this is my fault. This PR adds tests that prohibit this.

@ilevkivskyi

Copy link
Copy Markdown
Member Author

@gvanrossum Thanks for review! I pushed new commits taking into account your comments. Now this is much simpler (and probably right) way to fix this.

@gvanrossum gvanrossum left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hide comment

At some point in the future we should also add comments explaining the inner workings of all these functions. (Or docstrings, but make it clear they are NOT public or even protected APIs.)

@ilevkivskyi

Copy link
Copy Markdown
Member Author

@gvanrossum

I implemented your latest comments in a new commit.

At some point in the future we should also add comments explaining the inner workings of all these functions. (Or docstrings, but make it clear they are NOT public or even protected APIs.)

This is a good idea, I will make a PR later this week.

@gvanrossum gvanrossum merged commit cf7ba5d into python:master Nov 7, 2016
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.

2 participants