[PYTHON MATRIX-SIG] Re: Using Packages for Numeric Python

Guido van Rossum guido@CNRI.Reston.Va.US
Mon, 09 Sep 1996 16:43:56 -0400


> > > What should I now call the module that used to be known as Numeric? 
> This
> > > is the module that contains all of the "core" functionality of the
> > > extension.
> > 
> > How about Numeric.Core?
> 
> 1) I don't want to type: Numeric.Core.array([1,2,3], Numeric.Core.Float32)
> 
> 2) "from Numeric import Core" seems even worse
> 
> 3) This would leave me usually doing: "from Numeric.Core import *" which is
> also less than ideal ;-)

OK, here's a trick that will let you write

	import Numeric

	Numeric.array(...)

1) Put all the core stuff in Numeric/Core.py.  The Numeric.Core.*
names will be the "official names" for all functions.

2) Provide a Numeric/__init__.py that somehow inserts everything from
Core into Numeric.  I think the shortest hack is the following:

	# This is Numeric/__init__.py
	exec "from Core import *" in __.__dict__

(I haven't tested this but since __ is a shortcut for the parent
module and __init__ is actually a submodule of Numeric, __ in
__init__.py should refer to Numeric itself, so it should work.)

--Guido van Rossum (home page: http://www.python.org/~guido/)

=================
MATRIX-SIG  - SIG on Matrix Math for Python

send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
=================