Skip to content
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

Python parameter/variable types should match classes, not all objects #3927

Merged
merged 1 commit into from
Jul 15, 2017
Merged

Python parameter/variable types should match classes, not all objects #3927

merged 1 commit into from
Jul 15, 2017

Conversation

rouge8
Copy link
Contributor

@rouge8 rouge8 commented Jul 13, 2017

Feature or Bugfix

  • Bugfix

Purpose/Details

Parameter and variable types in the Python domain have the counter-intuitive behavior of matching instance methods (or likely any other objects) rather than classes, e.g.:

class Foo(object):
    def list(self):
        """List some things."""

def bar(x):
    """
    :param x: x
    :type x: list
    """

bar() will link to Foo.list() rather than the standard library
list type.

Relates

Parameter and variable types in the Python domain have the
counter-intuitive behavior of matching instance methods (or likely any
other objects) rather than classes, e.g.:

```python
class Foo(object):
    def list(self):
        """List some things."""

def bar(x):
    """
    :param x: x
    :type x: list
    """
```

`bar()` will link to `Foo.list()` rather than the standard library
`list` type.
@rouge8
Copy link
Contributor Author

rouge8 commented Jul 13, 2017

Not sure why Travis is failing on Python 3.6 😕

@tk0miya tk0miya added this to the 1.7 milestone Jul 15, 2017
@tk0miya tk0miya merged commit 58ad864 into sphinx-doc:master Jul 15, 2017
@tk0miya
Copy link
Member

tk0miya commented Jul 15, 2017

Thank you for contribution!

note: the error came from new mypy package. It is already fixed at HEAD.

@lazka
Copy link

lazka commented Feb 12, 2018

Is there any way to use a function as a parameter type now?

edit: ah, using :type:, never mind :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants