Re: [Numpy-discussion] fromiter shape argument -- was Re: For loop tips

2006-08-31 Thread Tim Hochberg
Torgil Svensson wrote: >> Yes. fromiter(iterable, dtype, count) works. >> > > Oh. Thanks. I probably had too old documentation to see this (15 > June). If it's not updated since I'll give Travis a rest about this, > at least until 1.0 is released :) > Actually I just knew 'cause I wrote it.

Re: [Numpy-discussion] fromiter shape argument -- was Re: For loop tips

2006-08-31 Thread Torgil Svensson
> Yes. fromiter(iterable, dtype, count) works. Oh. Thanks. I probably had too old documentation to see this (15 June). If it's not updated since I'll give Travis a rest about this, at least until 1.0 is released :) > Regardless, L is only iterated over once. How can this be true? If no size is

Re: [Numpy-discussion] fromiter shape argument -- was Re: For loop tips

2006-08-30 Thread Tim Hochberg
Torgil Svensson wrote: >>return uL,asmatrix(fromiter((idx[x] for x in L),dtype=int)) >> > > Is it possible for fromiter to take an optional shape (or count) > argument in addition to the dtype argument? Yes. fromiter(iterable, dtype, count) works. > If both is given it could > preallocat

Re: [Numpy-discussion] fromiter

2006-06-10 Thread Tim Hochberg
David M. Cooke wrote: >On Sat, Jun 10, 2006 at 01:18:05PM -0700, Tim Hochberg wrote: > > >>I finally got around to cleaning up and checking in fromiter. As Travis >>suggested, this version does not require that you specify count. From >>the docstring: >> >>fromiter(...) >>fromiter(

Re: [Numpy-discussion] fromiter

2006-06-10 Thread Robert Kern
David M. Cooke wrote: > Can this be integrated into array() so that array(iterable, dtype=dtype) > does the expected thing? That was rejected early on because array() is so incredibly overloaded as it is. http://article.gmane.org/gmane.comp.python.numeric.general/5756 -- Robert Kern "I have c

Re: [Numpy-discussion] fromiter

2006-06-10 Thread David M. Cooke
On Sat, Jun 10, 2006 at 01:18:05PM -0700, Tim Hochberg wrote: > > I finally got around to cleaning up and checking in fromiter. As Travis > suggested, this version does not require that you specify count. From > the docstring: > > fromiter(...) > fromiter(iterable, dtype, count=-1)

Re: [Numpy-discussion] fromiter

2006-06-03 Thread Tim Hochberg
Travis Oliphant wrote: >Tim Hochberg wrote: > > >>Some time ago some people, myself including, were making some noise >>about having 'array' iterate over iterable object producing ndarrays in >>a manner analogous to they way sequences are treated. I finally got >>around to looking at it serio

Re: [Numpy-discussion] fromiter

2006-06-03 Thread Travis Oliphant
Tim Hochberg wrote: > Some time ago some people, myself including, were making some noise > about having 'array' iterate over iterable object producing ndarrays in > a manner analogous to they way sequences are treated. I finally got > around to looking at it seriously and once I came to the fol