[NEWBIE] Sequence indices & method docstrings
Duncan Booth
duncan at rcp.co.uk
Mon Sep 4 08:44:46 EDT 2000
More information about the Python-list mailing list
Mon Sep 4 08:44:46 EDT 2000
- Previous message (by thread): [NEWBIE] Sequence indices & method docstrings
- Next message (by thread): a long time ago...
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
p.agapow at ic.ac.uk (Paul-Michael Agapow) wrote in <1egfqnh.1biw837161s15iN%p.agapow at ic.ac.uk>: >Point the second: in a set of container classes I'm implementing, I have >some synonym methods, i.e. methods with different names that just call >the other implemented function. Ideally, these should share the same >docstring, but instead of just copying it, I thought it would be easy to >just put in: > >class MyQueue: > def push (self, item): > """The docstring for push!""" > # blah, blah, blah ... > > def enqueue (self, item): > __class__.push.__doc__ > # just a synomym > self.push (item) > >... which didn't work. Other possibilities included: > > enqueue.__doc__ = push.__doc__ > Is there a good reason why you don't just do this? class MyQueue: def push (self, item): """The docstring for push!""" # blah, blah, blah ... enqueue = push
- Previous message (by thread): [NEWBIE] Sequence indices & method docstrings
- Next message (by thread): a long time ago...
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list