
Why not allow direct use of subpackages of scipy? That is, if I want to ``describe`` a series, why not allow:: scipy.stats.describe(myseries) instead of:: from scipy import stats stats.describe(myseries) or:: from scipy.stats import describe describe(myseries) I am sure this is a naive question about package structure, but I'd like to understand. Thank you, Alan Isaac

Alan, Why not:
from scipy.stats import describe describe(series)
It's all in the way you specify the import Brandon Powered by CardScan -----Original Message----- From: scipy-user-bounces@scipy.org [mailto:scipy-user-bounces@scipy.org] On Behalf Of Alan G Isaac Sent: Thursday, September 27, 2007 11:01 AM To: SciPy Users List Subject: [SciPy-user] stats module accessibility Why not allow direct use of subpackages of scipy? That is, if I want to ``describe`` a series, why not allow:: scipy.stats.describe(myseries) instead of:: from scipy import stats stats.describe(myseries) or:: from scipy.stats import describe describe(myseries) I am sure this is a naive question about package structure, but I'd like to understand. Thank you, Alan Isaac _______________________________________________ SciPy-user mailing list SciPy-user@scipy.org http://projects.scipy.org/mailman/listinfo/scipy-user

On 27/09/2007, Alan G Isaac <aisaac@american.edu> wrote:
Why not allow direct use of subpackages of scipy?
That is, if I want to ``describe`` a series, why not allow::
scipy.stats.describe(myseries)
In [1]: import scipy.stats In [2]: scipy.stats.describe? Type: function Base Class: <type 'function'> String Form: <function describe at 0x86640d4> Namespace: Interactive File: /usr/lib/python2.5/site-packages/scipy/stats/stats.py Definition: scipy.stats.describe(a, axis=0) Docstring: [...] You can't just do "import scipy" and access the subpackages, because that would mean that a bare "import scipy" had to recursively load all subpackages, which can be expensive - many shared libraries to load, for example. This is standard behaviour for python packages. Anne

On Thu, 27 Sep 2007, Anne Archibald apparently wrote:
You can't just do "import scipy" and access the subpackages, because that would mean that a bare "import scipy" had to recursively load all subpackages, which can be expensive many shared libraries to load, for example.
OK. I guessed that would be the answer.
This is standard behaviour for python packages.
As I warned, it was a naive question. As a user, what I notice of course is that some subpackages are immediately available (e.g., random and fft) and that others are not. Thanks, Alan

Alan G Isaac wrote:
On Thu, 27 Sep 2007, Anne Archibald apparently wrote:
You can't just do "import scipy" and access the subpackages, because that would mean that a bare "import scipy" had to recursively load all subpackages, which can be expensive many shared libraries to load, for example.
OK. I guessed that would be the answer.
This is standard behaviour for python packages.
As I warned, it was a naive question. As a user, what I notice of course is that some subpackages are immediately available (e.g., random and fft) and that others are not.
That's numpy, not scipy. numpy is just small enough for that to be feasible. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco
participants (4)
-
Alan G Isaac
-
Anne Archibald
-
Nuttall, Brandon C
-
Robert Kern