[Matplotlib-users] from pylab import * imports oldnumeric

2007-01-31 Thread Gary Ruben
I just picked up a problem posted over on the numpy list. I noticed that
from pylab import * is importing the oldnumeric-wrapper versions of
zeros(), ones() and empty(), and presumably other things too, into the
interactive namespace. Shouldn't it be picking up the versions from
numpy's main namespace for interactive use?

I picked this up because I use ipython -pylab and noticed that zeros()
etc. was generating integers instead of floats by default.

In ipython:

   Welcome to pylab, a matplotlib-based Python environment.
   For more information, type 'help(pylab)'.

In [1]: zeros?
Type:   function
Base Class: type 'function'
String Form:function zeros at 0x010CA3F0
Namespace:  Interactive
File:   c:\python24\lib\site-packages\numpy\oldnumeric\functions.py
Definition: zeros(shape, typecode='l', savespace=0, dtype=None)
Docstring:
 zeros(shape, dtype=int) returns an array of the given
dimensions which is initialized to all zeros


In [2]: import numpy as n

In [3]: n.zeros?
Type:   builtin_function_or_method
Base Class: type 'builtin_function_or_method'
String Form:built-in function zeros
Namespace:  Interactive
Docstring:
 zeros((d1,...,dn),dtype=float,order='C')

Return a new array of shape (d1,...,dn) and type typecode with all
it's entries initialized to zero.

--
Gary R.

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] from pylab import * imports oldnumeric

2007-01-31 Thread Christopher Barker
Gary Ruben wrote:
 I just picked up a problem posted over on the numpy list. I noticed that
 from pylab import * is importing the oldnumeric-wrapper versions of
 zeros(), ones() and empty(), and presumably other things too, into the
 interactive namespace. Shouldn't it be picking up the versions from
 numpy's main namespace for interactive use?

My understanding is that pylab (and Numerix) is maintaining backward 
compatibility with itself, so the oldnumeric  form is the right one.

Another reason NOT to EVER use import *

Before too long, hopefully we'll only have to deal with numpy.

-Chris

-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/ORR(206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115   (206) 526-6317   main reception

[EMAIL PROTECTED]

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users