[SciPy-Dev] import scipy convention in docstring Examples
David Goldsmith
d.l.goldsmith@gmail....
Sun Jun 13 15:20:22 CDT 2010
On Sun, Jun 13, 2010 at 1:03 PM, <josef.pktd@gmail.com> wrote:
> On Sun, Jun 13, 2010 at 3:43 PM, David Goldsmith
> <d.l.goldsmith@gmail.com> wrote:
> > On Sun, Jun 13, 2010 at 12:41 PM, Warren Weckesser
> > <warren.weckesser@enthought.com> wrote:
> >>
> >> David Goldsmith wrote:
> >> > Hi! For the Examples in the numpy docstrings, we have the convention
> >> > that we do not need to include "import numpy" (because that is done by
> >> > our automated example tester) but when we're using a numpy namespace
> >> > object, we need to prefix it with "np." (because that's how our
> >> > automated tester is importing it). Is there a similar convention for
> >> > docstring Examples in scipy?
> >> >
> >>
> >> According to http://projects.scipy.org/numpy/wiki/CodingStyleGuidelines
> ,
> >> "The examples may assume that import numpy as np is executed before the
> >> example code in numpy, and import scipy as sp in scipy. " But sp does
> >> not appear to be widely used; I can only find it used in
> >> ndimage.geometric_transform and ndimage.map_coordinates.
> >
> > Thanks, Warren, I d
>
>
> import scipy is not very useful, since it doesn't import the sub-packages
>
> I think the most common use is
> from scipy import signal, optimize, stats
>
> or maybe
> import scipy.ndimage as ndi
>
> but I don't know whether there are recommendations for the convention or
> rules
>
The recommendation is: consistency - when you need to import something in an
Example, search the Wiki using Examples%import%<name-of-object-to-import>
and check any results for a precedent, then follow it (or change it
consistently if you feel it is inappropriate for some reason and/or you see
that the results aren't consistent).
DG
>
> Josef
>
>
> >>
> >> Warren
> >>
> >>
> >> > DG
> >> >
> ------------------------------------------------------------------------
> >> >
> >> > _______________________________________________
> >> > SciPy-Dev mailing list
> >> > SciPy-Dev@scipy.org
> >> > http://mail.scipy.org/mailman/listinfo/scipy-dev
> >> >
> >>
> >> _______________________________________________
> >> SciPy-Dev mailing list
> >> SciPy-Dev@scipy.org
> >> http://mail.scipy.org/mailman/listinfo/scipy-dev
> >
> >
> >
> > --
> > Mathematician: noun, someone who disavows certainty when their
> uncertainty
> > set is non-empty, even if that set has measure zero.
> >
> > Hope: noun, that delusive spirit which escaped Pandora's jar and, with
> her
> > lies, prevents mankind from committing a general suicide. (As
> interpreted
> > by Robert Graves)
> >
> > _______________________________________________
> > SciPy-Dev mailing list
> > SciPy-Dev@scipy.org
> > http://mail.scipy.org/mailman/listinfo/scipy-dev
> >
> >
> _______________________________________________
> SciPy-Dev mailing list
> SciPy-Dev@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-dev
>
--
Mathematician: noun, someone who disavows certainty when their uncertainty
set is non-empty, even if that set has measure zero.
Hope: noun, that delusive spirit which escaped Pandora's jar and, with her
lies, prevents mankind from committing a general suicide. (As interpreted
by Robert Graves)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-dev/attachments/20100613/2d60bbb1/attachment.html
More information about the SciPy-Dev
mailing list