Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Attribut als Funktion dokumentieren?

0 views
Skip to first unread message

Ole Streicher

unread,
Oct 2, 2009, 4:34:11 AM10/2/09
to
Hallo,

als Ergebnis zu der hier parallel laufenden Diskussion zum asynchronen
Updaten tritt jetzt ein neues Problem auf: ich habe ein Attribut,
welches eigentlich eine (extern aufrufbare) Funktion ist und welches ich
auch gerne als solche dokumentieren möchte. Mit epydoc sieht die
Dokumentation so aus:

--------------------8<------------------------------------
from other_posting import DoAsync

class MyClass(object):
'''Ipsis at urbi...

:ivar update: call this when the object should be updated.
:type update: argument-less function
'''
def __init__(self):
self.update = DoAsync(self._do_update)

def _do_update(self):
...
--------------------8<------------------------------------

Das führt jedoch dazu, dass self.update nicht unter den Funktionen,
sondern unter den Attributen gelistet wird. Auch mit dem normalen pydoc
hat "self.update" keinen passenden Docstring. Wie bekomme ich da einen
unter?

Viele Grüße

Ole

Thomas Rachel

unread,
Oct 2, 2009, 6:52:26 AM10/2/09
to
Ole Streicher schrieb:

> --------------------8<------------------------------------
> from other_posting import DoAsync
>
> class MyClass(object):
> '''Ipsis at urbi...
>
> :ivar update: call this when the object should be updated.
> :type update: argument-less function
> '''
> def __init__(self):
> self.update = DoAsync(self._do_update)
>
> def _do_update(self):
> ...
> --------------------8<------------------------------------

Das schreit zwar nach einem Decorator, aber damit kriegt man das Problem
leider auch nicht in den Griff...

Evtl. so:

class MyClass(object):
'''Ipsis at urbi...

:ivar update: call this when the object should be updated.
:type update: argument-less function
'''
def __init__(self):

self._update = DoAsync(self._do_update)

def update(self):
return self._update()

def _do_update(self):
...


Thomas

0 new messages