[Numpy-discussion] Proposal: Indexing by callables

2022-07-30 Thread Matteo Santamaria
Hi all,

I’d like to open a discussion on supporting callables within 
`np.ndarray.__getitem__`. The intent is to make long function-chaining 
expressions more ergonomic by removing the need for an intermediary, temporary 
value.

Instead of

```
tmp = long_and_complicated_expression(arr)
return tmp[tmp > 0]
```

we would allow

```
return long_and_complicated_expression(arr)[lambda x: x > 0]
```

This feature has long been supported by pandas’ .loc accessor, where I’ve 
personally found it very valuable. In accordance with the pandas 
implementation, the callable would be required to take only a single argument.

In terms of semantics, it should always be the case that `arr[fn] == 
arr[fn(arr)]`.

I do realize that expanding the API and supporting additional indexing methods 
is not without cost, so I open the floor to anyone who’d like to weigh in 
for/against the proposal.

___
NumPy-Discussion mailing list -- numpy-discussion@python.org
To unsubscribe send an email to numpy-discussion-le...@python.org
https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member address: arch...@mail-archive.com


[Numpy-discussion] Documentation Team meeting - Monday August 1st at 2pm UTC

2022-07-30 Thread Melissa Mendonça
Hi all!

Our next Documentation Team meeting will happen on *Monday, August 1st* at
***2PM UTC***.

All are welcome - you don't need to already be a contributor to join. If
you have questions or are curious about what we're doing, we'll be happy to
meet you!

If you wish to join on Zoom, use this link:

https://zoom.us/j/96219574921?pwd=VTRNeGwwOUlrYVNYSENpVVBRRjlkZz09

Here's the permanent hackmd document with the meeting notes (still being
updated):

https://hackmd.io/oB_boakvRqKR-_2jRV-Qjg


Hope to see you around!

* You can also visit https://scientific-python.org/calendars to add the
NumPy community calendar as an .ics file to your preferred calendar manager

- Melissa
___
NumPy-Discussion mailing list -- numpy-discussion@python.org
To unsubscribe send an email to numpy-discussion-le...@python.org
https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member address: arch...@mail-archive.com