[SciPy-dev] ndimage - docfiller and output_type

Ralf Gommers ralf.gommers@googlemail....
Wed Oct 28 14:35:58 CDT 2009


On Wed, Oct 28, 2009 at 7:07 PM, Pauli Virtanen <pav+sp@iki.fi<pav%2Bsp@iki.fi>
> wrote:

> Wed, 28 Oct 2009 11:13:10 -0400, josef.pktd wrote:
> [clip]
> > No, I like the current system where we don't have any boiler plate in
> > the individual distributions. Following your maxwell example, we would
> > get a lot of repetition of template code in the individual
> > distributions.
>
> Then, I'd suggest just adding
>
>        %(info)s
>
> or so, that will be expanded to the full boilerplate information block.
> Then, only this would be repeated in each distribution docstring -- not
> too bad.
>
> It is clearer and cleaner if the distribution docstring is a template,
> resides in the class docstring, and the final product is assembled by
> substitution rather than by concatenating magically generated parts.
> (Think, for example -- why are HTML templating languages so popular, as
> opposed to just concatenating blocks of HTML code?)
>

Yes, this is what I was thinking. The default in each `_gen` class could for
example be:
 """
The distribution name.

%(rv_info)s

Methods
-----------
%(allmethods)s

%(call_info)s

Examples
-------------
%(default_example)s
"""

If you really want to keep it short, you could even just do:
"""
The distribution name.

%(default_contents)s
"""

Now imagine you want a References section. Here you just add it in at the
right place in my first example. If the whole template is in the
rv_continuous class, there is just no way to add this section.

Additionally, this allows you to remove 3 keywords from the constructor
(name, longname, extradoc). So the extra overhead is very small, and you
gain a lot.

Cheers,
Ralf


> --
> Pauli Virtanen
>
> _______________________________________________
> Scipy-dev mailing list
> Scipy-dev@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-dev/attachments/20091028/944ad8f3/attachment.html 


More information about the Scipy-dev mailing list