Creating a new instance of a class by what is sent in?

2005-04-11 Thread ChinStrap
I am sorry if this is obvious, but I am not seeing it.  How would I go
about creating a new type that is of the same type as a class sent into
the function?

new = foo.__init__() refers to the current foo, not a new fresh
instance of my class.  The only way I can think of is to make a large
if-elif chain of isinstances, but that loses the generality I am after.

Thank you for your help.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: numarray.array can be VERY slow

2005-04-10 Thread ChinStrap
Yes because that is a bad way to things. There is no reason to be
working with a list when it could be done directly with numarray.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: THE GREATEST NEWS EVER ! °º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°` (newsgroup-post 127)

2005-04-09 Thread ChinStrap
Thats not what Jack Chick says =(

http://www.chick.com/catalog/tractlist.asp

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Best editor?

2005-04-06 Thread ChinStrap
Well I would be more than willing to learn Emacs if it does all these
things you speak of, but really I can't get started because the default
scheme is so friggin ugly it isn't funny.

Anyone want to send me a configuration setup with Python in mind, and
decent colors?

-- 
http://mail.python.org/mailman/listinfo/python-list


Best editor?

2005-04-05 Thread ChinStrap
When not using the interactive prompt, what are you using? I keep
hearing everyone say Emacs, but I can't understand it at all. I keep
trying to learn and understand why so many seem to like it because I
can't understand customization even without going through a hundred
menus that might contain the thing I am looking for (or I could go
learn another language just to customize!).

Personally I like SciTE, it has everything I think a midweight editor
should: code folding, proper python support, nice colors out of the
box, hotkey access to compile (I'm sure emacs does this, but I couldn't
figure out for the life of me how), etc.

Opinions on what the best is? Or reading I could get to maybe sway me
to Emacs (which has the major advantage of being on everyone's system).

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Numarray newbie question

2005-03-29 Thread ChinStrap
Are there no windows binaries for SciPy for python 2.4 yet?  I try to
run the installer and it complains that it can't find python 2.3.

Besides that, vectorize is exactly what i want.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Numarray newbie question

2005-03-29 Thread ChinStrap
Oh well. I am downloading all the things to build it, but in the mean
time I just did:

def get_y_mat(x_ind,y_ind):

return self.y_min + y_ind*self.dy

def get_x_mat(x_ind,y_ind):

return self.x_min + x_ind*self.dx

self.x_mat=fromfunction(get_x_mat,matshape)
self.y_mat=fromfunction(get_y_mat,matshape)

def fxy(x_ind,y_ind):
x=self.x_min + x_ind*self.dx
y=self.y_min + y_ind*self.dx
return f(x,y)

def vxy(x_ind,y_ind):
x=self.x_min + x_ind*self.dx
y=self.y_min + y_ind*self.dx
return v(x,y)

self.f_mat=fromfunction(fxy,matshape)
self.v_mat=fromfunction(vxy,matshape)

As you can see I am just repeating calculations in fxy and vxy that I
have already done for x_mat and y_mat.  This is still faster than
saying:

self.f_mat = array([f(x,y) for x in x_mat for y in y_mat],matshape)

by a noticable amount.

-- 
http://mail.python.org/mailman/listinfo/python-list


Numarray newbie question

2005-03-28 Thread ChinStrap
I know there are probably alternatives for this with the standard
library, but I think that would kill the speed I get with numarray:

Say I have two 2-dimensional numarrays (x_mat and y_mat, say), and a
function f(x,y) that I would like to evaluate at every index.
Basically I want to be able to say f(x_mat,y_mat) and have it return a
numarray with the same shape and element wise evaluation of f.  I know,
I want a ufunc, but they look scary to write my own. Are there any
functions that do this? Or is writing ufuncs easier than it seems?

Thanks,
-Chris Neff

-- 
http://mail.python.org/mailman/listinfo/python-list