Skip to content

convention when input can be an instance of a class #43

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

Open
cmeeren opened this issue Nov 20, 2015 · 2 comments
Open

convention when input can be an instance of a class #43

cmeeren opened this issue Nov 20, 2015 · 2 comments

Comments

@cmeeren
Copy link

cmeeren commented Nov 20, 2015

What is the convention for parameter type if a parameter is an instance of specific class, e.g. datetime.datetime?

Specifically, I have a parameter which can be either a float, datetime.date, or datetime.datetime. How should I write this in the parameter section?

  • my_param : float or date or datetime
  • my_param : float or datetime.date or datetime.datetime
  • my_param : float or :class:datetime.date or :class:datetime.datetime
  • my_param : float or :class:~datetime.date or :class:~datetime.datetime
  • something else?

And of course, maybe a comma instead of the first "or", but that's nitpicking (which I like by the way) and not too important in this context (unless I'm mistaken).

@larsoner
Copy link
Collaborator

I don't think that they currently get linked automatically. I have done a little bit of testing, and this sort of thing seems to work to generate links to MyClass and MyOtherClass docs:

my_param : float or :class:`MyClass` or :class:`MyOtherClass`

It would be nice if they could be auto-detected, though. I wonder if actually we could just try to auto-link them all with :class: and see what happens.

@larsoner
Copy link
Collaborator

For a bad first pass at how this could be automated see #57

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

No branches or pull requests

2 participants