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

Hello there and can I please have closure comments represented or am I doing something wrong? #53

Closed
michaelcoconnor opened this issue Jun 17, 2015 · 1 comment

Comments

Projects
None yet
2 participants
@michaelcoconnor
Copy link

commented Jun 17, 2015

Mr. Sushi himself asked that I explain here the problem that I am having: http://stackoverflow.com/questions/1125970/python-documentation-generator/18258983?noredirect=1#comment46361911_18258983.

Here's the requested example:

def Example( ):
'''
Some comments.
'''

def deco(funct):

    def wrapper(*args, **kargs):

        ##############################
        # start a closure

        def exampleclosure():
            '''
            Some comments about the closure.
            '''

            return "Example() was run."

        # end a closure
        ##############################

        print funct()
        print  exampleclosure()

    return wrapper  

return deco

@example()
def dummy():
return "Ran dummy."

dummy()

So yes, I do a lot of decorators. And here's the pdoc output:

nummatenv)mike@Presario:~/retailbacktest/code$ pdoc example.py
Ran dummy.
Example() was run.

Module example

Functions

Example()
Some comments.

dummy(_args, *_kargs)
(nummatenv)mike@Presario:~/retailbacktest/code$

So of course I was hoping to see some output that contains "Some comments about the closure." But there is none. (Markdown accentuates "Module example" and "Functions" due to the lines of dashes that are in the pdoc output, but you must be familiar with that.)

Thanks much for all of the good work,
-Mike

@cortesi

This comment has been minimized.

Copy link
Member

commented Jun 3, 2018

I'm afraid I don't see how we can sensibly provide docs for functions in nested scope. Pdoc aims to document the public portions of an API, and inner functions like this are by definition implementation details. They are only executed at runtime, when the enclosing function is executed.

@cortesi cortesi closed this Jun 3, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.