Setzen Sie den Docstring auf einen Ausdruck innerhalb von def

Ich möchte das einstellenfunc_doc (als Ausdruck)innerhalb def.

def f():
    '''My function help''' #Set the docstring

def g():
    "My function " + "help" # An expression, so not read as a docstring
    # can I put something here to set the docstring as an expression?
g.func_doc # is None
g.func_doc = "My function " + "help" # This works

Ist das möglich?

(Ich kann mir zwei Gründe dafür vorstellen: Importieren einer Funktion aus einem Modul (und Sie möchten auch den Docstring importieren) und Verwenden von aLexer.)

Antworten auf die Frage(4)

Ihre Antwort auf die Frage