Re: [Numpy-discussion] migration of all scipy.org mailing lists

2017-03-26 Thread Ralf Gommers
On Fri, Mar 24, 2017 at 9:57 PM, Ralf Gommers 
wrote:


> On Fri, Mar 24, 2017 at 12:27 AM, Neal Becker  wrote:
>
>> Ralf Gommers wrote:
>>
>> > On Thu, Mar 23, 2017 at 12:18 AM, Neal Becker 
>> wrote:
>> >
>> >> Has anyone taken care of notifying gmane about this?
>> >>
>> >
>> > We will have to update this info in quite a few places after the move is
>> > done. Including Gmane, although that site hasn't been working for half a
>> > year so is pretty low on the priority list.
>> >
>> > Ralf
>>
>> I'm reading/writing to you via gmane, so I think it is working :)
>>
>
> No it's not, archives are the key feature of Gmane (and what we link to
> from http://scipy.org/scipylib/mailing-lists.html) and those haven't been
> working since last September. See https://lars.ingebrigtsen.no/
> 2016/07/28/the-end-of-gmane/ for why.
>
>
>
> Your mail forwarding still happens to work, but that's not nearly as
> interesting a feature. Since Gmane is more or less unmaintained and at the
> moment http://gmane.org/ gives me a blank page, I don't think I'll bother
> to contact them (unless archives come back).
>

The move is complete, and I have updated the mailing list addresses at:
- http://scipy.org/scipylib/mailing-lists.html (done)
- numpy codebase (PR https://github.com/numpy/numpy/pull/8840)
- scipy codebase (PR https://github.com/scipy/scipy/pull/7226)
- Nabble (opened issue
http://support.nabble.com/All-scipy-org-mailing-list-moved-to-python-org-td7597902.html),
also for ipython-dev

If anyone knows of other places, please let me know (or fix it).

Ralf
___
NumPy-Discussion mailing list
NumPy-Discussion@python.org
https://mail.python.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] heads up: gufuncs on empty arrays and NpyIter removal of empty axis

2017-03-26 Thread Sebastian Berg
Hi all,

just a small heads up for gufunc hackers and low level iterator users.
We will probably very soon put in a commit into master that will allow
the removal of empty axis from NpyIter/nditer, effectively removing the
error:

"ValueError: cannot remove a zero-sized axis from an iterator"

and allowing:

```
arr = np.zeros((100, 0))
it = np.nditer((arr,),
   flags=["zerosize_ok", "multi_index"])
it.remove_axis(1)
```

As a follow up step, we also allow that gufuncs may be called with
empty inner loop sizes. In some cases that may mean that your gufuncs
may need special handling for lets say:

```
arr = np.zeros((100, 0))  # note the 0 dimension.
my_gufunc(arr)
```

If this creates problems for you, please tell, so that we can slow down
or undo the change. As an example, we have a matrix_multiply gufunc for
testing purpose, which did not zero out the output for the case of
`matrix_multiply(np.ones((10, 0)), np.ones((0, 10)))`. So this could
turn code that errored out for weird reasons into wrong results in rare
cases.

- Sebastian

signature.asc
Description: This is a digitally signed message part
___
NumPy-Discussion mailing list
NumPy-Discussion@python.org
https://mail.python.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Structured array creation with list of lists and others

2017-03-26 Thread Kirill Balunov
Allan thank you for your draft! I agree with you that  (not in mine ) in
general case it would be hard to resolve all corner cases. Also I think if
someone read numpy reference linearly, he/she will have some insight that
list of tuples are necessary (but it was not my case).

For me one problem is that in some cases numpy allows a lot freedom, but in
other it is unnecessarily strict. Another one is exception messages (but
this is certainly subjective).



2017-03-24 19:48 GMT+03:00 Allan Haldane :

> On 03/23/2017 02:16 PM, Kirill Balunov wrote:
> > It was the first time I tried to create a structured array in numpy.
> > Usually I use pandas for heterogeneous arrays, but it is one more
> > dependency to my project.
> >
> > It took me some time (really, much more than some), to understand the
> > problem with structured array creation. As example:
> >
> > I had list of list of this kind:
> > b=[[ 1, 10.3, 12.1, 2.12 ],...]
> >
> > And tried:
> > np.array(b, dtype='i4,f4,f4,f4')
> >
> > Which raises some weird exception:
> > TypeError: a bytes-like object is required, not 'int'
> >
> > Two hours later I found that I need list of tuples. I didn't find any
> help
> > in documentation and could not realize that the problem with the inner
> > lists...
> >
> > Why there is such restriction - 'list of tuples' to create structured
> > array? What is the idea behind that, why not list of lists, or tuple of
> > lists or ...?
> >
> > Also the exception does not help at all...
> > p.s.: It looks like that dtype also accepts only list of tuples. But I
> can
> > not catch the idea for this restrictions.
> >
>
> The problem is that numpy needs to distinguish between multidimensional
> arrays and structured elements. A "list of lists" will often trigger
> numpy's broadcasting rules, which is not what you want here.
>
> For instance, should numpy interpret your input list as a 2d array of
> dimension Lx4 containing integer elements, or a 1d array of length L of
> structs with 4 fields?
>
> In this particular case maybe numpy could, in principle, figure it out
> from what you gave it by calculating that the innermost dimension is
> the same length as the number of fields. But there are other cases (such
> as assignment) where similar ambiguities arise that are harder to
> resolve. So to preserve our sanity we want to require that structures be
> formatted as tuples all the time.
>
> I have a draft of potential updated structured array docs you can read
> here:
> https://gist.github.com/ahaldane/7d1873d33d4d0f80ba7a54ccf1052eee
>
> See the section "Assignment from Python Native Types (Tuples)", which
> hopefully better warns that tuples are needed. Let me know if you think
> something is missing from the draft.
>
> (WARNING: the section about multi-field assignment in the doc draft is
> incorrect for current numpy - that's what I'm proposing for the next
> release. The rest of the docs are accurate for current numpy)
>
> Agreed that the error message could be changed.
>
> Allan
>
> ___
> NumPy-Discussion mailing list
> NumPy-Discussion@python.org
> https://mail.python.org/mailman/listinfo/numpy-discussion
>
___
NumPy-Discussion mailing list
NumPy-Discussion@python.org
https://mail.python.org/mailman/listinfo/numpy-discussion