by geertj · 12y ago · 0 comments
For example, this is a real method in one of my projects:
def listen(self, address, ssl=False, ssl_args={}):
pass
I like the way this turns up in the docs because it's immediately clear that ssl_args needs to be a dict. Otherwise I have to describe it in words.Why not just add @param annotations in your docstrings instead?
If they need to touch this argument in an overridden method and they don't know what they are doing, then yes.
> Why not just add @param annotations in your docstrings instead?
I'm using Sphinx and it renders them separately. I want the empty dict to show up in the function signature.
There are other ways to emphasize it ought to be a dict/mappable. Change its name to be suffixed as "_dict", for example?