[SciPy-Dev] import scipy convention in docstring Examples
Sun Jun 13 14:54:33 CDT 2010
On Sun, Jun 13, 2010 at 12:43 PM, David Goldsmith
> On Sun, Jun 13, 2010 at 12:41 PM, Warren Weckesser <
> email@example.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.
Sorry, hit send too soon. :( As I was saying: thanks Warren - obviously, I
need to do a little better research before I post. As far as the low
occurrence, however, this actually does not surprise me much: aside from the
simple dearth of scipy docstrings from which such a search would produce
results, unlike the numpy examples, where it is common to want/need
something in the numpy-level namespace, scipy is structured such that it
will probably be rare that things in the scipy-level namespace are
needed/wanted - I mainly asked to just get it announced: in the Examples in
the scipy docstrings, explicitly import the namespaces you need, EXCEPT for
scipy itself - if you need something from that namespace, it will already be
there for you, abbreviated as "sp."
> Thanks, Warren, I d
>> > DG
>> > ------------------------------------------------------------------------
>> > _______________________________________________
>> > SciPy-Dev mailing list
>> > SciPy-Dev@scipy.org
>> > http://mail.scipy.org/mailman/listinfo/scipy-dev
>> SciPy-Dev mailing list
> 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)
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...
More information about the SciPy-Dev