Re: switching to numpy and failing, a user story

2006-10-09 Thread Robert Kern
Apologies for the dupe. It looked like something went wrong with the first send (and the first post was partly incorrect to begin with). -- 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

Re: Python component model

2006-10-09 Thread Robert Kern
the rest of the Enthought crew on the enthought-dev mailing list if you have any questions: https://mail.enthought.com/mailman/listinfo/enthought-dev -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our ow

Re: Python component model

2006-10-09 Thread Robert Kern
Edward Diener No Spam wrote: > Robert Kern wrote: >> Edward Diener No Spam wrote: >> >>> There's nothing wrong with Python's introspection. In fact Python's >>> facilities in this area and its support for metadata are stronger than >>>

Re: Python component model

2006-10-11 Thread Robert Kern
tive resources: >> >> http://dabodev.com >> http://case.lazaridis.com/wiki/DaboAudit > > Well, then, why not contribute? Or are you waiting for everyone else > to do it for you? No, he's just a troll that enjoys telling everyone what to do. Don't try to get him to contribu

Re: Python component model

2006-10-11 Thread Robert Kern
Ilias Lazaridis wrote: > Robert Kern wrote: >> No, he's just a troll that enjoys telling everyone what to do. Don't try to >> get >> him to contribute anything useful; it won't work. > > Mr. Kern! Seeing you working on such a seemingly excellent product

Re: Python component model

2006-10-11 Thread Robert Kern
Ilias Lazaridis wrote: > Robert Kern wrote: >> Ilias Lazaridis wrote: >>> Robert Kern wrote: >>>> No, he's just a troll that enjoys telling everyone what to do. Don't try >>>> to get >>>> him to contribute anything useful; it

Re: Max-plus library

2006-10-16 Thread Robert Kern
ntrol theory packages, but as I neither know what max-plus dioids are, nor have I any current interest in them, I can't give you any better pointers. -- 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 att

Re: Plotting histograms

2006-10-16 Thread Robert Kern
pylab.hist(eig, 10) Or, if you're at the interactive prompt (but remember that it is inadvisable to do so in modules): from matplotlib.pylab import * [N,x] = hist(eig, 10) You will probably want to review the section of the tutorial on importing modules if you don't understand

Re: pylab package dependencies

2006-10-17 Thread Robert Kern
Lou Pecora wrote: > In article <[EMAIL PROTECTED]>, > Robert Kern <[EMAIL PROTECTED]> wrote: > >> I presume what you did was something like this: >> >>from matplotlib import pylab >>[N,x] = hist(eig, 10) >> >> What you actually wan

Re: pylab package dependencies

2006-10-17 Thread Robert Kern
uration file: http://docs.python.org/inst/config-syntax.html -- 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 -- http://mail.python.org/mailman/listinfo/python-list

Re: why should dict not be callable?

2006-10-17 Thread Robert Kern
s there > some reason a subscriptable thing like a dict should *not* be callable? Because you can pass key_dict.get instead. Or even key_dict.__getitem__ if you don't want the default=None behavior of the .get() method. -- Robert Kern "I have come to believe that the whole world i

Re: pylab package dependencies

2006-10-17 Thread Robert Kern
Lou Pecora wrote: > In article <[EMAIL PROTECTED]>, > Robert Kern <[EMAIL PROTECTED]> wrote: > >> Lou Pecora wrote: >> >>> The only problem I'm having is getting ipython to run. Not installed in >>> /usr/local/bin (although all o

Re: Plotting histograms

2006-10-17 Thread Robert Kern
ne 15, in > [N,x]=pylab.hist(eig, 10) # make a histogram > ValueError: too many values to unpack > > Can anyone help me out with this?? pylab.hist() does not return two values, it returns three. Sorry I didn't catch that earlier. -- Robert Kern "I have come to believe

Re: Looking for assignement operator

2006-10-18 Thread Robert Kern
;> def __init__(self, val): >>> assert(isinstance(val, int)) >>> self._val = val >>> >>> a = MyInt(10) >>> >>> # Here i need to overwrite the assignement operator >>> a = 12 >>> > >> Could the "

Re: portable extensions options for external libraries

2006-10-18 Thread Robert Kern
th something like the following section (unindented): # Uncomment and modify the following section to configure the locations of the # Boost and GSL headers and libraries. #[build_ext] #include-dirs=/opt/local/include,/usr/local/include #library-dirs=/opt/local/lib,/usr/local/lib C

Re: Plotting histograms

2006-10-18 Thread Robert Kern
s on the matplotlib-users mailing list instead of here. -- 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 -- http://mai

Re: ZODB and Python 2.5

2006-10-20 Thread Robert Kern
all Python 2.5 alongside 2.4, install ZODB, run the test suite. -- 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 -- http://mail.python.org/mailman/listinfo/python-list

Re: Inheriting property functions

2006-10-20 Thread Robert Kern
7;t recognizing its inheritence of A's methods get_a and set_a > during creation. Inheritance really doesn't work that way. The code in the class suite gets executed in its own namespace that doesn't know anything about inheritance. The inheritance rules operate in attribute acces

Re: pylint: What's wrong with the builtin map()

2006-10-22 Thread Robert Kern
t pylint is entirely configurable. If you don't want to be bothered with warnings about map() which you are going to ignore, a simple modification to the pylint configuration file will prevent it from doing that check. -- Robert Kern "I have come to believe that the who

Re: Set operations in Numeric

2006-10-23 Thread Robert Kern
py.org/svn/scipy/trunk/Lib/sandbox/arraysetops/arraysetops.py -- 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 -- http://mail.python.org/mailman/listinfo/python-list

Re: mean ans std dev of an array?

2006-10-24 Thread Robert Kern
in range(1000)) > # compute n, sum(x), and sum(x**2) with single pass through list > n,sumx,sumx2 = reduce(lambda a,b:(a[0]+b[0],a[1]+b[1],a[2]+b[2]), ((1,x,x*x) > for x in lst) ) > sd = sqrt( (sumx2 - (sumx*sumx/n))/(n-1) ) Don't do that. If you *must* restrict yourself to one pass, t

Re: numbers to string

2006-10-24 Thread Robert Kern
, something like the following: >>> from numpy import * >>> y = [116, 114, 121, 32, 116, 104, 105, 115] >>> a = array(y, dtype=uint8) >>> z = a.tostring() >>> z 'try this' -- Robert Kern "I have come to believe that the whole wo

Re: question about True values

2006-10-25 Thread Robert Kern
n the context of an if: statement, they mean that the truth value of the object (found using the special method .__nonzero__()) is True, not that it is equal to True. It's a bit of an abuse on the English language, but what isn't in software? -- Robert Kern "I have come to believe t

Re: question about True values

2006-10-25 Thread Robert Kern
marray import array >>>> bool(array([1,2])) > Traceback (most recent call last): > File "", line 1, in ? > RuntimeError: An array doesn't make sense as a truth value. Use any(a) > or all(a). numpy also has this behavior. Numeric yielded to the temptation to

Re: numpy numbers converted wrong

2006-10-26 Thread Robert Kern
s, somewhat. You can forestall that by casting to Python floats or ints if that is causing problems for you. > should one better stay away from numpy in current stage of numpy development? > I remember, with numarray there were no such problems. Not really, no. -- Robert Kern "I hav

Re: Truth value of iterators [was: question about True values)

2006-10-26 Thread Robert Kern
ing) an iterator object to grow a > 'len' method is the simplest way. And indeed, they are already allowed to do so. Python 2.4.1 (#2, Mar 31 2005, 00:05:10) Type "copyright", "credits" or "license" for more information. In [1]: len(iter(())) Out[1]: 0 In [

Re: NumPy 1.0 release

2006-10-26 Thread Robert Kern
rceforge and gmane are just horrible to use. Sorry, I don't think that Google Groups does mirroring like GMane does. While we will be migrating the numpy-discussion list away from Sourceforge, it will be to the scipy.org server, not Google Groups. -- Robert Kern "I have come to belie

Re: NumPy 1.0 release

2006-10-26 Thread Robert Kern
Robert Kern wrote: > George Sakkis wrote: >> By the way, it would be great if numpy's mailing list was mirrored to a >> google group; sourceforge and gmane are just horrible to use. > > Sorry, I don't think that Google Groups does mirroring like GM

Re: latest numpy & scipy - incompatible ?

2006-10-28 Thread Robert Kern
compiled for numpy 1.0. All you need to do is recompile, though, and everything will work. -- 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 underlyi

Re: Integrating Python with Fortran

2006-10-31 Thread Robert Kern
e fairly standard ways. http://elmer.sourceforge.net/ -- 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 -- http://mail.python.org/mailman/listinfo/python-list

Re: Computing FFT with Python NumPy 1.0

2006-11-01 Thread Robert Kern
, -1.15270364e+00-0.41954982j, -3.37938524e+00-2.83564091j, 5.e-01+0.8660254j , 3.2062e-02+0.18198512j, 3.2062e-02-0.18198512j, 5.e-01-0.8660254j , -3.37938524e+00+2.83564091j, -1.15270364e+00+0.41954982j]) -- Robert Kern "

Re: Python in sci/tech applications

2006-11-02 Thread Robert Kern
quot;Enthought Edition" Python distribution. http://code.enthought.com/enthon/ -- 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 -- http://mail.python.org/mailman/listinfo/python-list

Re: Python in sci/tech applications

2006-11-02 Thread Robert Kern
[EMAIL PROTECTED] wrote: > Robert Kern: >> We distribute mingw set up to do this with our "Enthought >> Edition" Python distribution. >> http://code.enthought.com/enthon/ > > Sorry, maybe I'm blind but I don't see MinGW listed in that page... >

Re: problem with svd in numpy

2006-11-02 Thread Robert Kern
se, it looks as if numpy_u == -matlab_u. How do numpy_vt and matlab_vt compare? Do they also have flipped signs? If so, then there is no problem. (u, vt) can be replaced with (-u, -vt). The SVD is not unique. Which one you get depends on the precise operations of the implementation. -- Robert

Re: Python in sci/tech applications

2006-11-02 Thread Robert Kern
Steve Holden wrote: > Robert Kern wrote: >> [EMAIL PROTECTED] wrote: >> >>> Robert Kern: >>> >>>> We distribute mingw set up to do this with our "Enthought >>>> Edition" Python distribution. >>>> http://code.enthought.c

Re: Python in sci/tech applications

2006-11-02 Thread Robert Kern
t\mingw32\bin\ to your PATH environment variable, and gcc.exe should be executable. -- 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." -

Re: Python in sci/tech applications

2006-11-03 Thread Robert Kern
ill written for MSVCRT.dll and Microsoft changed some of the internal details that they rely upon. For many (most?) extensions, this won't matter, either. C++ extensions using iostreams have a problem, IIRC. Unfortunately, neither approach works for all extensions. It may even be the ca

Re: Python in sci/tech applications

2006-11-03 Thread Robert Kern
applications. It simply hasn't received enough attention recently to move to a different runtime. If you would like to volunteer your time to do the necessary work to allow it to link to modern runtimes, please do so. You will receive the undying thanks of many, many Pythoneers. --

Re: Python in sci/tech applications

2006-11-03 Thread Robert Kern
Thomas Nelson wrote: > How hard would it be to have numpy/ scipy part of the python standard > library? scipy will never, ever be part of the standard library. Some subset of numpy may eventually make it into the standard library, but not any time soon. -- Robert Kern "I have come

Re: numpy help

2006-11-03 Thread Robert Kern
unction which only knows about floats and complex floats, it refuses the temptation to guess what you meant and raises an error. -- 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 ha

Re: building python with utf-8 default encoding?

2006-11-06 Thread Robert Kern
)) should alway be 'ascii'. Otherwise, programs written on one machine will not run on other machines. -- 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

Re: Unicode/ascii encoding nightmare

2006-11-06 Thread Robert Kern
ou would want .decode() (which converts a byte string into a Unicode string), not .encode() (which converts a Unicode string into a byte string). You get UnicodeDecodeErrors even though you are trying to .encode() because whenever Python is expecting a Unicode string but gets a byte string, it tries t

Re: Unicode/ascii encoding nightmare

2006-11-06 Thread Robert Kern
John Machin wrote: > Indeed yourself. Have you ever considered reading posts in > chronological order, or reading all posts in a thread? That presumes that messages arrive in chronological order and transmissions are instantaneous. Neither are true. -- Robert Kern "I have come to b

Re: C wrapper

2006-11-07 Thread Robert Kern
Sheldon wrote: > This function is there and is called init_mymodule() but I have other > functions that are not static. Is the module's name "_mymodule"? Or is it "mymodule"? -- Robert Kern "I have come to believe that the whole world is an enigma, a harml

Re: Finding Nonzero Elements in a Sparse Matrix

2006-11-07 Thread Robert Kern
that object. In [1]: from scipy.sparse import lil_matrix In [2]: A = lil_matrix((3,3)) In [3]: A[1,2] = 10 In [4]: A[2,0] = -10 In [5]: Acoo = A.tocoo() In [6]: Acoo.row Out[6]: array([2, 1]) In [7]: Acoo.col Out[7]: array([0, 2]) -- Robert Kern "I have come to believe that the whol

Re: assigning a sequence to an array

2006-11-08 Thread Robert Kern
s We will need some more information from you when you come to the numpy list. Please reduce your problematic code to the smallest, self-contained script that demonstrates the problem, and post it and the exact output that you get. -- Robert Kern "I have come to believe that the whole worl

Re: Py3K idea: why not drop the colon?

2006-11-09 Thread Robert Kern
nately, my Google-fu has not located an actual paper. It might be in here somewhere: http://homepages.cwi.nl/~steven/abc/publications.html -- 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 i

Re: Simple question to split

2006-11-09 Thread Robert Kern
single call to .split() if you preprocess the string first: a.replace(',', ' ').split() -- 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 underlyi

Re: Printing to file, how do I do it efficiently?

2006-11-09 Thread Robert Kern
gt; I'm guessing that the slow part is the fact that I am converting the > data to character format and writing it one character at a time. What > is a better way of doing this, or where should I look to find a better way? data.tostring() -- Robert Kern "I have come

Re: Py3K idea: why not drop the colon?

2006-11-10 Thread Robert Kern
[EMAIL PROTECTED] wrote: > P.S. I felt I just had to tie this into the thread on profanity somehow. > But notice that I didn't mention nazis or Hitler. ;-) You did it just now! -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that

Re: numpy/scipy: correlation

2006-11-11 Thread Robert Kern
numpy and scipy through and through, but most of them don't hang out on comp.lang.python. http://www.scipy.org/Mailing_Lists scipy.optimize.leastsq() can be told to return the covariance matrix of the estimated parameters (m and o in your example; I have no idea what you think r-coeff is

Re: numpy/scipy: correlation

2006-11-11 Thread Robert Kern
Robert Kern wrote: > robert wrote: >> Is there a ready made function in numpy/scipy to compute the correlation >> y=mx+o of an X and Y fast: >> m, m-err, o, o-err, r-coef,r-coef-err ? > scipy.optimize.leastsq() can be told to return the covariance matrix of the > es

Re: numpy/scipy: correlation

2006-11-11 Thread Robert Kern
s. The difference between the two models is that the first places no restrictions on the distribution of x. The second does; both the x and y marginal distributions need to be normal. Under the first model, the correlation coefficient has no meaning. -- Robert Kern "I have come to believe that

Re: reduce to be removed?

2006-11-11 Thread Robert Kern
it's not possible > to treat a for-loop as an expression (which is what a list > comprehension requires). As with all such things, you stick the implementation in a well-named function and simply call the function everywhere. The implementation never needs to be a one-liner expression.

Re: reduce to be removed?

2006-11-11 Thread Robert Kern
Dustan wrote: > Robert Kern wrote: >> Dustan wrote: >>> Fredrik Lundh wrote: >>>> if you care about writing robust code, why not just use a for-loop, >>>> and the list extend method? >>> Because I'm embedding this expression in a list compr

Re: numpy/scipy: correlation

2006-11-12 Thread Robert Kern
sturlamolden wrote: > Robert Kern wrote: > >> The difference between the two models is that the first places no >> restrictions >> on the distribution of x. The second does; both the x and y marginal >> distributions need to be normal. Under the first model, the cor

Re: numpy/scipy: correlation

2006-11-12 Thread Robert Kern
his was fixed in SVN. > PPS: > > A compatible scipy binary (0.5.2?) for numpy 1.0 was announced some weeks > back. Think currently many users suffer when trying to get started with > incompatible most-recent libs of scipy and numpy. Well, go ahead and poke the people that said they

Re: Py3K idea: why not drop the colon?

2006-11-13 Thread Robert Kern
onal preference is that having the colon is more readable. Yours isn't. That's fine. Debating on that basis, however, is pretty pointless. -- 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 att

Re: Py3K idea: why not drop the colon?

2006-11-13 Thread Robert Kern
that the colon was missing if the compiler > didn't point it out, is it really that readable? For me, I tend to get > annoyed at language "features" that I'm constantly tripping over. Never. -- Robert Kern "I have come to believe that the whole world is an enigm

Re: Test-driven development of random algorithms

2006-11-13 Thread Robert Kern
ility". In library code, never call the functions in the random module. Always take as an argument a random.Random instance. When testing, you can seed your own Random instance and all of your numbers will be the same for every test run. This kind of design is A Good Thing(TM) outside of unit tes

Re: Py3K idea: why not drop the colon?

2006-11-14 Thread Robert Kern
Hendrik van Rooyen wrote: > "Robert Kern" <[EMAIL PROTECTED]> wrote: > > >> Michael Hobbs wrote: >>> True enough. Although, I have to ask how many times you define a new >>> function only to have Python spit a syntax error out at you saying that

Re: reduce to be removed?

2006-11-14 Thread Robert Kern
f double, unsigned int, etc. -- 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 -- http://mail.python.org/mailman/listinfo/python-list

Re: reduce to be removed?

2006-11-15 Thread Robert Kern
Antoon Pardon wrote: > On 2006-11-15, Robert Kern <[EMAIL PROTECTED]> wrote: >> Dustan wrote: >> >>> 2. While I haven't taken a good look at NumPy, my intuition tells me it >>> won't work with complex data types, which wouldn't work for me

Re: accessing fortran modules from python

2006-11-16 Thread Robert Kern
nd up installing numpy anyways. http://numpy.scipy.org All of the f2py documentation is currently in the source, so start here: http://projects.scipy.org/scipy/numpy/browser/trunk/numpy/f2py/docs/README.txt Using f2py to wrap Fortran subroutines is actually a fair bit simpler than wrapping C c

Re: About alternatives to Matlab

2006-11-16 Thread Robert Kern
e avoid Scilab but I'm not > sure why. If anybody knows the reason I'd be happy to hear it. I think you just stated it. -- 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

Re: using FFTW3 with Numeric on Windows

2006-05-28 Thread Robert Kern
? scipy can use FFTW3 as its FFT routines. http://www.scipy.org -- 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 -- htt

Re: dynamically loaded libraries

2006-05-28 Thread Robert Kern
ay() is supposed to be called in the initialization function of the other extension modules. That will make sure that multiarray is imported and the function pointers are available for dereferencing. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma t

Re: numpy bug

2006-06-01 Thread Robert Kern
cket. In the meantime, the .accumulate() method works correctly; you can use the last item to get the correct result for .reduce(). -- 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 i

Re: Conditional Expressions in Python 2.4

2006-06-01 Thread Robert Kern
A.M wrote: > Do we have the conditional expressions in Python 2.4? No. -- 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

Re: Sampling a population

2006-06-02 Thread Robert Kern
http://svn.scipy.org/svn/scipy/trunk/Lib/sandbox/montecarlo/ Ask on one of the scipy mailing lists if you need help building it. http://www.scipy.org/Mailing_Lists -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our ow

Re: reordering elements of a list

2006-06-03 Thread Robert Kern
map method. There is documentation on map() about halfway down this page: http://docs.python.org/lib/built-in-funcs.html Here's a tutorial which you should read: http://docs.python.org/tut/tut.html -- Robert Kern "I have come to believe that the whole world is an enigma, a harm

Re: Max function question: How do I return the index of the maximum value of a list?

2006-06-04 Thread Robert Kern
7;t it return the one with the highest index? -- 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 -- http://mail.python.org/mailman/listinfo/python-list

Re: C# equivalent to range()

2006-06-05 Thread Robert Kern
Fuzzyman wrote: > Erik Max Francis wrote: >>Here were the "harsh" and "whining" responses to his question he's >>complaining about: > > Fair enough. Maybe they weren't "harsh" and "whining", just patronising > and abru

Re: Vectorization

2006-06-06 Thread Robert Kern
t do matrices, and numarray is deprecated. Please point new users to numpy, instead. http://numeric.scipy.org/ Since the OP seems to already be using one of Numeric/numarray/numpy, (given "a.shape"), I would suggest that he ask the question on the appropriate mailing list: https://lists.s

Re: fsolve() from scipy crashes python on windows

2006-06-06 Thread Robert Kern
ing with scipy, and the exact code that causes the crash. -- 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 -- http://mail.p

Re: Exeucte a system command in python script

2006-06-08 Thread Robert Kern
ss.html It also works in Pythons as old as 2.2, but you'll have to install it separately. The website for the separate release is down at the moment, but when it comes back up: http://www.lysator.liu.se/~astrand/popen5/ -- Robert Kern "I have come to believe that the whole world is

Re: Exeucte a system command in python script

2006-06-08 Thread Robert Kern
ess call(['something', 'or', 'other']) You need to learn how imports work in Python. Please read the tutorial: http://docs.python.org/tut/tut.html -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terri

Re: numeric/numpy/numarray

2006-06-13 Thread Robert Kern
here: http://www.scipy.org/History_of_SciPy -- 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 -- http://mail.python.org/mailman/listinfo/python-list

Re: "groupby" is brilliant!

2006-06-13 Thread Robert Kern
>is :-( > > Not at all! A python list *knows* its length at all times. len() is a > constant time lookup of an internal attribute. The point is that you had to create the list in the first place. g is an iterator. -- Robert Kern "I have come to believe that the whole world is

Re: memory leak problem with arrays

2006-06-14 Thread Robert Kern
to be a bug that sounds like this, but it was fixed some time ago. Also, please try to narrow your program down to the smallest piece of code that runs and still displays the memory leak. Thank you. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma t

Re: comparing two arrays

2006-06-19 Thread Robert Kern
are best handled on numpy-discussion rather than comp.lang.python . https://lists.sourceforge.net/lists/listinfo/numpy-discussion -- 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

Re: OS specific command in Python

2006-06-19 Thread Robert Kern
the ssh feature like > one does on the command line > > ssh [EMAIL PROTECTED] .etc > > How can I do this easily ? http://www.python.org/doc/current/lib/module-subprocess.html -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless e

Re: Initializing a set from a list

2006-06-20 Thread Robert Kern
09, 0.91966, -0.13550388182991072, 0), (0.874239991, 0.7001, -0.2123048713754, 0)]) >>> Please copy-and-paste the exact code that you wrote and the exact output. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigm

Re: Initializing a set from a list

2006-06-21 Thread Robert Kern
t;[1, 2, 3, 3] >>> >>>set([1, 2, 3]) >> >>Pylab shadows the built-in set name, which is one of the reasons you >>should generally use "import XXX" instead of "from XXX import *". > > Ahh. Understood. Thank you very much. It should be n

Re: Update on Memory problem with NumPy arrays

2006-06-21 Thread Robert Kern
ill usable, but aren't being actively developed. There's a pure-Python array package somewhere, but I forget the name. -- 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

Re: OverflowError: math range error...

2006-06-22 Thread Robert Kern
use arrays as truth values since the desired meaning (alltrue or sometrue) is ambiguous. -- 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 -- http://mail.python.org/mailman/listinfo/python-list

Re: Numeric N-dimensional array initialization

2006-06-22 Thread Robert Kern
flat = arange(10) In [11]: a Out[11]: array([[0, 1, 2], [3, 4, 5]]) In [12]: for i in a.flat: : print i : : 0 1 2 3 4 5 -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by ou

Re: Numeric N-dimensional array initialization

2006-06-22 Thread Robert Kern
6, 0], [0, 9,10, 828202281, 0], [7, 0, 0, 0, 0], [0, 0, 0, 0, 0]]) If you have more complicated needs, we can talk about them on numpy-discussion.

Re: Problem with sets and Unicode strings

2006-06-27 Thread Robert Kern
regular byte string, not a Unicode string. The encoding declaration only controls how the file is parsed. The string literal that you use for FIELDS is a regular string literal, not a Unicode string literal, so the object it creates is an 8-bit byte string. The tuple containment test is attemptin

Re: Ascii Encoding Error with UTF-8 encoder

2006-06-27 Thread Robert Kern
Mike Currie wrote: > Can anyone explain why I'm getting an ascii encoding error when I'm trying > to write out using a UTF-8 encoder? Please read the Python Unicode HOWTO. http://www.amk.ca/python/howto/unicode -- Robert Kern "I have come to believe that the whole

Re: to py or not to py ?

2006-06-28 Thread Robert Kern
atter the size. http://www.scipy.org/NumPy -- 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 -- http://mail.python.org/mailman/listinfo/python-list

Re: Immutability

2006-06-28 Thread Robert Kern
writing. class Foo(object): def __init__(self, bar): self._bar = bar @property def bar(self): return self._bar -- 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

Re: to py or not to py ?

2006-06-28 Thread Robert Kern
Threads/index.shtml A good event-driven framework for Python is Twisted. It's what I use for the program I mention above. http://twistedmatrix.com/trac/ -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own m

Re: ? on scipy.fftpack

2006-06-28 Thread Robert Kern
nts of x can be destroyed. Notes: y == rfft(irfft(y)) within numerical accuracy. -- 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.&quo

Re: Problem with sets and Unicode strings

2006-06-29 Thread Robert Kern
Fächer") and a unicode string later (u"Fächer"). But set objects can't know that that's the problem or even if it *is* a problem. -- 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 -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem with sets and Unicode strings

2006-06-29 Thread Robert Kern
Dennis Benzinger wrote: > Robert Kern wrote: >> Dennis Benzinger wrote: >>> Ok, I understand. >>> But isn't it a (minor) problem that using a set like this: >>> >>> # -*- coding: UTF-8 -*- >>> >>> FIELDS_SET = set(("Fächer&

Re: Concatenating strings

2006-06-30 Thread Robert Kern
..,"zzz"] > blist = "" > for x in alist: >blist += x > > But is there a cleaner and faster way of doing this? blist = ''.join(alist) -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terri

Re: property __doc__

2006-06-30 Thread Robert Kern
David Isaac wrote: > To access the doc string of a property, > I have to use the class not an instance. > Why? Because getting the attribute from the instance gets the calculated value (the value returned from the getter function), not the actual property object. -- Robert Kern &qu

Re: Dictionary .keys() and .values() should return a set [with Python 3000 in mind]

2006-07-01 Thread Robert Kern
...: ...: In [3]: set(d.values()) --- exceptions.TypeError Traceback (most recent call last) /Users/kern/ TypeError: list objects are unhashable Also, I may need keys to map to different objects that happen to be equal. -- Robert Kern "I have come to believe that the w

Re: numarray

2006-07-04 Thread Robert Kern
org/NumPy > my goal is to somehow define multi-dimensional arrays of strengs... >>> from numpy import * >>> a = array([['some', 'strings'],['in an', 'array']], dtype=object) >>> a array([[some, strings], [in an, arr

<    6   7   8   9   10   11   12   13   14   15   >