FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

%psource · Issue #613 · aimacode/aima-python · GitHub

%psource #613

Description

We use %psource in notebooks to refer to code, and that is good. But the code is displayed in a popup window, and one drawback is that you can only display one function at a time this way. Another drawback is that the code doesn't scroll with the rst of the document (this can sometimes be an advantage, sometimes a drawback).

I propose to add to utils the following function, and prefer to use it over %psource:

import inspect

def psource(*functions):
    "Print the source code for the given function(s)."
    print('\n\n'.join(inspect.getsource(fn) for fn in functions))

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL