Skip to content

Document Comments in Python #3869

Closed Answered by b4n
jhunacek asked this question in Q&A
May 10, 2024 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

I don't think there is a way to get two different comment colors without modifying the lexer code and Geany's styling.

However, the "pythonic" way is using triple-quoted strings (or well, I guess any string will do, but usually documentation is longer than that) as the first statement in e.g. a function. You can then access this in the __doc__ property of the associated symbol.

def foo():
    """This fooes around"""
    return 0xf00

print(foo.__doc__)

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@jhunacek
Comment options

Answer selected by jhunacek
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants