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

Tooltip docstrings can suggest information from the wrong class #770

Open
bennuttall opened this issue Feb 12, 2019 · 1 comment
Open

Tooltip docstrings can suggest information from the wrong class #770

bennuttall opened this issue Feb 12, 2019 · 1 comment
Labels

Comments

@bennuttall
Copy link
Member

Both the turtle module and the gpiozero module provide classes with a function/method named forward. When you use gpiozero's Robot class, you are shown the docstring for Turtle's forward function:

( You may need to set the env var GPIOZERO_PIN_FACTORY=mock for this to work on a PC )

from gpiozero import Robot

robot = Robot((2, 3), (4, 5))

robot.forward(

mu

The example in turtle's docstring suggests you can use forward(25) but gpiozero's forward only allows 0->1.

This obviously isn't just related to Raspberry Pi, but any module which contains matching function names.

Tangentially related to #590

@devdanzin
Copy link
Contributor

This seems to be an issue of not having introspection-based autocomplete. If we add Robot.forward() to the API the autocompletion will then offer both alternatives, but e.g. Motor.forward() will still only show whatever we added to the API. Also, it will only show what the API for a given mode includes.

Maybe there's a way to always show what class/module the shown help string is coming from, to make it easy to know when it doesn't apply to a given situation. It does show that information in the autocompletion list, but it's gone from the help.

Reviewing potential conflicts and adding more definitions to the APIs could help.

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

No branches or pull requests

3 participants