question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Renamed: Better form arguments and docstrings.

See original GitHub issue

When defining bilinear forms you always write

@bilinear_form
def bilin(u, du, v, dv, w):
    pass

namely, the function arguments are in the same order always.

It would be convenient to have a snippet like this and other examples available in the docstring(s) of bilinear_form (and linear_form) so it can be quickly copy-pasted from REPL (help(bilinear_form)) without remembering the order of arguments and what w contains.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
kinnalacommented, Dec 4, 2018

Random idea: we could also directly modify AST in the decorators to transform u into u[0] using NodeTransformer (and pretty much arbitrary substitutions).

0reactions
kinnalacommented, Feb 28, 2020

This was done a while ago, new forms will be released in 1.0.0.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Writing Functions in Python.txt - GitHub
We'll cover docstrings and why they matter and how to know when you need to turn a chunk of code into a function....
Read more >
11 Comments, Docstrings, and Type Hints - Invent with Python
Type hints are directives you can add to your Python source code to specify the data types of variables, parameters, and return values....
Read more >
Writing Functions In Python - Hylke Rozema
Now add the arguments section, using the Google style for docstrings. Use str to indicate a string. Add a returns section that informs...
Read more >
How to document a method with parameter(s)? - Stack Overflow
Since docstrings are free-form, it really depends on what you use to parse code to generate API documentation.
Read more >
Documenting Python APIs with Docstrings
Python docstrings form the __doc__ attributes attached to modules, ... When two or more consecutive input parameters have exactly the same type, shape...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found