[Numpy-discussion] Re: Please consider dropping Python 3.9 support for Numpy 2.0

2024-05-08 Thread Aaron Meurer
then maybe that's a sign that CPython shouldn't either. I'll make the same argument now that I made in 2016 about dropping 2.7 support https://www.asmeurer.com/blog/posts/moving-away-from-python-2/. If users want to use older versions of Python, that's their prerogative, but they then have no rea

[Numpy-discussion] Re: Please consider dropping Python 3.9 support for Numpy 2.0

2024-05-06 Thread Aaron Meurer
On Mon, May 6, 2024 at 3:05 PM Ralf Gommers wrote: > > > > On Mon, May 6, 2024 at 10:42 PM Oscar Benjamin > wrote: >> >> On Mon, 6 May 2024 at 19:59, Aaron Meurer wrote: >> > >> > On Mon, May 6, 2024 at 6:34 AM Mark Harfouche >> > w

[Numpy-discussion] Re: Please consider dropping Python 3.9 support for Numpy 2.0

2024-05-06 Thread Aaron Meurer
r expect the packaging issues that will arise when NumPy 2.0 is released will be more general than this. The central issue being that no one pinned NumPy < 2 until recently (and I'm sure many aren't even doing it at all yet), and on PyPI, there's no way to update pinning metadata except by doing a ne

[Numpy-discussion] Re: numpy 2.0.x has been branched.

2024-03-08 Thread Aaron Meurer
How bad are the NumPy 2.0 breakages in SymPy? We could do a backport release if they are serious. Aaron Meurer On Fri, Mar 8, 2024 at 2:46 PM Oscar Benjamin wrote: > > Hi Chuck, > > Is there a rough expected landing time for NumPy 2.0? > > Also does the branching mean

[Numpy-discussion] Re: ENH: Add 'axis' kwarg to np.tile

2024-02-29 Thread Aaron Meurer
generally, not just for this one suggestion) Also FWIW, tile() is new in the 2023.12 standard (just released a few days ago), so that potentially strengthens the argument that an axis keyword was missed during standardization and should be added. Aaron Meurer On Thu, Feb 29, 2024 at 4:42 PM Nathan

[Numpy-discussion] Re: Change definition of complex sign (and use it in copysign)

2024-01-03 Thread Aaron Meurer
suggest only adding such a thing if there's an actual need for it. I imagine presently if anyone does need this they just use copysign(x1.view(float64), x2).view(complex128). Aaron Meurer On Sat, Dec 23, 2023 at 8:36 AM Dom Grigonis wrote: > > To me this sounds like a reasonable

[Numpy-discussion] Re: How to sample unique vectors

2023-11-17 Thread Aaron Meurer
vectors of length dims but it doesn't seem to work. Aaron Meurer On Fri, Nov 17, 2023 at 3:31 PM Stefan van der Walt via NumPy-Discussion wrote: > > On Fri, Nov 17, 2023, at 11:07, Robert Kern wrote: > > If the arrays you are drawing indices for are real in-memory arrays for > pre

[Numpy-discussion] Re: How to sample unique vectors

2023-11-17 Thread Aaron Meurer
5022258 Wouldn't it be better to just use random.randint to generate the vectors directly at that point? If the number of possibilities is more than 2**64, birthday odds of generating the same vector twice are on the order of 1 in 2**32. And you can always do a unique() rejection check if you really

[Numpy-discussion] Re: Switching default order to column-major

2023-11-12 Thread Aaron Meurer
nstead of a[..., 0] to get a contiguous piece of memory. The degree to which this matters in practice will depend on the exact thing a given library is doing and also things like the size of your data relative to your CPU caches. Aaron Meurer On Sun, Nov 12, 2023 at 8:18 AM Kevin Sheppard wrote: &

[Numpy-discussion] Re: Adding NumpyUnpickler to Numpy 1.26 and future Numpy 2.0

2023-10-11 Thread Aaron Meurer
, are really misleading. I'm also curious about this more generally. We tend to think of the fully qualified name of a class as being an implementation detail for many libraries and only the top-level lib.Name should be used, but many things in the language (including this) break this. Aaron Meurer

[Numpy-discussion] Re: Adding NumpyUnpickler to Numpy 1.26 and future Numpy 2.0

2023-10-09 Thread Aaron Meurer
the pickle file size. Aaron Meurer On Fri, Oct 6, 2023 at 10:17 AM Nathan wrote: > > Hi all, > > As part of the ongoing work on NEP 52 we are getting close to merging the > pull request that changes numpy.core to numpy._core. > > While working on this we realized that numpy pickl

[Numpy-discussion] Re: Proposal to accept NEP 52 (Python API cleanup for 2.0)

2023-09-15 Thread Aaron Meurer
text outside of code blocks, and making sure that complete English sentences are used everywhere. Aaron Meurer On Fri, Sep 15, 2023 at 12:14 PM Ralf Gommers wrote: > > Hi all, > > A lot of work has been happening to implement NEP 52 > (https://numpy.org/neps/nep-0052-python-api-cle

[Numpy-discussion] Re: Find location of slice in it's base

2023-08-31 Thread Aaron Meurer
construct a view directly given a base, offset, shape, and strides, but I think ideally that's what you'd want. Aaron Meurer On Thu, Aug 31, 2023 at 1:25 PM Dom Grigonis wrote: > > Hi everyone, > > I am working with shared arrays and their slices. And trying to subclass > ndarray

[Numpy-discussion] Re: Precision changes to sin/cos in the next release?

2023-05-31 Thread Aaron Meurer
(mpmath.sin(np.pi/2)) 1.0 That's 32 9's after the decimal point. (Things work out nicer at the 1s than the 0s because the derivatives of the trig functions are zero there, meaning the Taylor series have a cubic error term rather than a squared one) Aaron Meurer > > I'm ambivalent about rev

[Numpy-discussion] Re: Introducing `np.types`

2023-02-15 Thread Aaron Meurer
I'm not sure I understand the objection to having "too many submodules", but if it's a concern, the exceptions could be added here instead of a separate np.exceptions, since exceptions are themselves just types. Aaron Meurer On Wed, Feb 15, 2023 at 2:33 PM Sebastian Berg wrote: >

[Numpy-discussion] Re: Efficiently represent 128-bit integers

2023-02-03 Thread Aaron Meurer
You could use a composite data type of two int64s https://numpy.org/doc/stable/user/basics.rec.html. It would not work with arithmetic, but you said you don't care about that. You'd just need one helper function to convert the data to a UUID string. Aaron Meurer On Fri, Feb 3, 2023 at 6:21 AM

[Numpy-discussion] Re: Numpy tools for getting the results of indexing operations

2023-01-31 Thread Aaron Meurer
and I would love to add them. Aaron Meurer On Mon, Jan 30, 2023 at 9:28 PM Mark Harfouche wrote: > I'm trying to make a few different file backed array-like objects. > > However, I find myself struggling to get all the indexing operations right. > > Is there a collection of utilit

[Numpy-discussion] Re: Road to NumPy 2.0

2023-01-20 Thread Aaron Meurer
; doing with this suite somewhere? > There are plans to work on an array API reporting site, which would allow different libraries to upload a report of compliance to a central site, which would produce something similar to the "HTML browser compliance" site you may have seen. Aaron

[Numpy-discussion] Re: Addition of useful new functions from the array API specification

2022-12-16 Thread Aaron Meurer
Another feature I missed that can be added to this list is the descending flag to sort() and argsort(). See https://github.com/numpy/numpy/issues/14728 and https://data-apis.org/array-api/latest/API_specification/generated/signatures.sorting_functions.sort.html. Aaron Meurer On Wed, Dec 7, 2022

[Numpy-discussion] Re: Addition of useful new functions from the array API specification

2022-12-13 Thread Aaron Meurer
On Mon, Dec 12, 2022 at 11:54 PM Sebastian Berg wrote: > > On Mon, 2022-12-12 at 18:20 -0500, Warren Weckesser wrote: > > On 12/12/22, Aaron Meurer wrote: > > > On Mon, Dec 12, 2022 at 8:46 AM Sebastian Berg > > > wrote: > > > > > > > >

[Numpy-discussion] Re: Addition of useful new functions from the array API specification

2022-12-12 Thread Aaron Meurer
On Mon, Dec 12, 2022 at 8:46 AM Sebastian Berg wrote: > > On Wed, 2022-12-07 at 14:21 -0700, Aaron Meurer wrote: > > Hi all. > > > > As discussed in today's community meeting, I plan to start working on > > adding some useful functions to NumPy which are part of th

[Numpy-discussion] Re: Addition of useful new functions from the array API specification

2022-12-09 Thread Aaron Meurer
t specifying behavior for complex numbers is more work than just integers and floats. So the first version of the spec did not include them. What this means is that some things relating to complex numbers (and in particular, things surrounding linear algebra) haven't been discussed as much yet. Aaron M

[Numpy-discussion] Re: Addition of useful new functions from the array API specification

2022-12-08 Thread Aaron Meurer
et been discussed for addition to the array API specification, which only recently gained support for complex numbers. Aaron Meurer > > > > > > > > On Wed, Dec 7, 2022 at 10:26 PM Aaron Meurer wrote: >> >> Hi all. >> >> As discussed in today's community

[Numpy-discussion] Addition of useful new functions from the array API specification

2022-12-07 Thread Aaron Meurer
question I have is which of the new functions proposed should be implemented as pure Python wrappers and which should be implemented in C as ufuncs/gufuncs? Unless there are any objections, I plan to start working on implementing these right away. Aaron Meurer

[Numpy-discussion] Re: Behavior of round(array)

2022-12-01 Thread Aaron Meurer
here shouldn't be distinct behavior for scalars vs. arrays, and the output dtype shouldn't be value-based. Aaron Meurer > > We could of course do other things (i.e. return an integer `intp` > array) but that would probably require a hard error for overflows > (which is different from `np.r

[Numpy-discussion] Re: Formally accept NEP 51: Changing the Representation of NumPy Scalars

2022-11-29 Thread Aaron Meurer
to hook into the doctest utilities.) A reusable script would be nice, since many projects are going to have doctests broken by this. I think there also may already be some existing tooling that just "fixes" doctests by making them match their output. Aaron Meurer > > I pla

[Numpy-discussion] Re: Create `np.exceptions` for new exceptions in NumPy?

2022-11-11 Thread Aaron Meurer
e existing exceptions will have done "from numpy import AxisError" or "except np.AxisError". So I think they would need to stay, or at least go through a deprecation. I personally have written code that imports VisibleDeprecationWarning. Aaron Meurer > > Sté

[Numpy-discussion] Re: NEP 51: Changing the Representation of NumPy Scalars

2022-10-31 Thread Aaron Meurer
in the past), and the decision to make everything copy-paste round-trippable. Are there also plans to add "np." to array() and the string forms of other objects? Aaron Meurer On Fri, Oct 28, 2022 at 2:55 AM Sebastian Berg wrote: > > Hi all, > > As mentioned earlier, I would li

[Numpy-discussion] Re: NEP 50 and cast safety for scalar assignment/conversions

2022-10-21 Thread Aaron Meurer
hat for a non-value based cast there should be a new type of casting rule that is non-value based only. Unless your entire suggestion is to change the definition of 'safe' to not be value-based. I wasn't completely clear about that. Aaron Meurer On Thu, Oct 20, 2022 at 7:30 AM Sebastian Berg wro

[Numpy-discussion] Re: Feature request: dot product along arbitrary axes

2022-07-05 Thread Aaron Meurer
hes np.inner but is not what I would expect. Does your fix > make it instead return a 1-d length-2 array? Yes. I incorrectly implemented vecdot using tensordot, but with my PR this would return a shape (2,) array (with the default axis=-1). Aaron Meurer > __

[Numpy-discussion] Re: Feature request: dot product along arbitrary axes

2022-07-05 Thread Aaron Meurer
, and lets you specify the axis. We'd want this function to be added to the main numpy namespace as well. Aaron Meurer On Tue, Jul 5, 2022 at 5:39 PM wrote: > > Maybe I wasn't clear, I'm talking about the 1-dimensional vector product, but > applied to N-D arrays of vectors. Certainly dot pro

[Numpy-discussion] Re: Feature request: dot product along arbitrary axes

2022-07-05 Thread Aaron Meurer
On Tue, Jul 5, 2022 at 5:49 PM Aaron Meurer wrote: > > The vecdot() function in the array API should be what you are looking > for (note that the current implementation in numpy.array_api is > incorrect, which I'm fixing at > https://github.com/numpy/numpy/pull/21928). It

[Numpy-discussion] Re: Fuzzing integration of Numpy into OSS-Fuzz

2022-06-08 Thread Aaron Meurer
geared toward exploring a wide search space and finding as many possible issues as possible, even if there isn't the immediate possibility of them becoming fixed. I've used Hypothesis on several projects that depend on NumPy and incidentally found several bugs in NumPy with it (for example, https://g

[Numpy-discussion] Re: NEP 29 and the faster Python release cadence

2022-05-26 Thread Aaron Meurer
On Thu, May 26, 2022 at 3:45 AM Matti Picus wrote: > On 26/5/22 05:40, Aaron Meurer wrote: > > >> We cannot do that (yet, at least). Failing to publish wheels for a > supported Python version on a major OS is far worse than dropping support > completely. This will remai

[Numpy-discussion] Re: Dropping the pdf documentation.

2022-05-25 Thread Aaron Meurer
. This does also mean that to be useful you actually need to build it on CI. If you don't, you will end up with docs that don't actually build any more by the release because of unseen errors (even without LaTeX math this will likely end up happening, so I would recommend against this). Aaron Meurer

[Numpy-discussion] Re: NEP 29 and the faster Python release cadence

2022-05-25 Thread Aaron Meurer
more Python versions is a burden. Having more builds on CI means longer wait times to merge PRs. And having to wait longer for new Python features is also annoying. Aaron Meurer ___ NumPy-Discussion mailing list -- numpy-discussion@python.org

[Numpy-discussion] Re: [Feature Request] Add alias of np.concatenate as np.concat

2022-05-10 Thread Aaron Meurer
This table lists all the array API spec names that are different in NumPy. Most should be addable with a simple alias. https://numpy.org/devdocs/reference/array_api.html#function-name-changes Aaron Meurer On Tue, May 10, 2022 at 12:47 AM Matti Picus wrote: > > The array API defines con

[Numpy-discussion] NEP 29 and the faster Python release cadence

2022-04-06 Thread Aaron Meurer
ready been discussed. Aaron Meurer ___ 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] Re: Exposing `from_dlpack` to the main namespace

2022-03-17 Thread Aaron Meurer
orted for creating arrays. But it's also true in general that the array API specification prefers a functional API to methods on the array object. Aaron Meurer > > > A class-/staticmethod would be an interesting API choice. But I > suppose it would mainly be nice if we have a clear in

[Numpy-discussion] Re: Allow for callable in indexing

2021-11-29 Thread Aaron Meurer
ally I think assignment expressions solve this problem just fine, and are no more unreadable than a lambda. Aaron Meurer > > `arr.filter()` could also work, but likely we won't be able to easily > agree on adding another method. And if you are already currying, maybe > a smal

[Numpy-discussion] Re: branching NumPy 1.22.x

2021-11-08 Thread Aaron Meurer
in that state either today or tomorrow. Aaron Meurer On Sun, Nov 7, 2021 at 12:44 PM Charles R Harris wrote: > > Hi All, > > I am aiming to branch NumPy 1.22.x next weekend. If there are any PRs that > you think need to be merged before the branch, please raise the i

[Numpy-discussion] Re: spam on the mailing lists

2021-10-06 Thread Aaron Meurer
post directly. We have had very minimal spam even in the queue (to be fair, I'm sure Google applies its own filtering), and only one in recent memory that got through, due to the moderators not reading the message contents carefully enough. Aaron Meurer On Tue, Oct 5, 2021 at 7:23 AM Robert Kern

[Numpy-discussion] Re: Running numpy.test() after pip install

2021-09-28 Thread Aaron Meurer
Could numpy include a variant (I'm not sure what setuptools calls this) so that 'pip install numpy[tests]' installs those extra dependencies? Aaron Meurer On Tue, Sep 28, 2021 at 11:33 AM Ralf Gommers wrote: > > > > On Tue, Sep 28, 2021 at 7:07 PM Kevin Sheppard > wrote: >

[Numpy-discussion] Re: deprecating float(x) for ndim > 0

2021-09-16 Thread Aaron Meurer
ompatible and the broadcasting of the lhs just adds 1s to its shape (which get implicitly removed in the assignment since slice assignment can't change an array's shape)? Aaron Meurer > > Cheers, > Nico > > On Thu, Sep 16, 2021 at 2:00 AM Aaron Meurer wrote: > > > > Pr

Re: [Numpy-discussion] deprecating float(x) for ndim > 0

2021-09-15 Thread Aaron Meurer
) >>> a[:] = np.array([[[5, 6, 7]]]) >>> a array([5, 6, 7]) Array assignment allows some sort of reverse broadcasting? Given this behavior, it seems to me that a[0] = np.array([5]) actually should work. Or is the idea that this entire behavior would be deprecated? Aaron Meurer

Re: [Numpy-discussion] np.trunc is inconsistent with array-api

2021-09-10 Thread Aaron Meurer
n is to cast to > integer right after the call to `trunc`. If that's true, then this may actually fix some bugs. If some code does trunc(x).astype(int) and x could be float or int, then the result will be wrong if x is int64 with values larger than ~2**54, which cannot fit exactly into float64,

Re: [Numpy-discussion] np.trunc is inconsistent with array-api

2021-09-09 Thread Aaron Meurer
Probably worth noting that np.round (np.around) already returns the same data type as the input. Aaron Meurer > > Reference: https://github.com/numpy/numpy/issues/19464 > > Possible Fix: > 1. We update the behaviour directly with an update to release note. > 2. We add a FutureWarning and u

Re: [Numpy-discussion] Is there a defined way to "unpad" an array, and if not, should there be?

2021-04-12 Thread Aaron Meurer
n ending slice of zero > differently -- you need to write something like x[20:] to undo padding by > [(20, 0)]. You can use x[20:x.shape[0] - 4] to avoid this inconsistency. Or construct the slice based on the original unpadded shape (x[20:20+orig_x.shape[0]]). Aaron Meurer > > >

Re: [Numpy-discussion] NEP: array API standard adoption (NEP 47)

2021-03-10 Thread Aaron Meurer
from other namespaces. That's generally considered a much harder problem, and there is the data interchange protocol to deal with it (https://data-apis.github.io/array-api/latest/design_topics/data_interchange.html). Aaron Meurer > > > I don't think we have to figure out everything up-f

Re: [Numpy-discussion] np.{bool,float,int} deprecation

2020-12-11 Thread Aaron Meurer
So np.bool == builtins.bool is actually fine. My concern here was that the discussion was about deprecating np.bool, meaning it would be removed from the namespace, which goes against what is currently in the spec. Aaron Meurer > > While it would be great if `np.bool_` could be spelt `np.bool`, I really &

Re: [Numpy-discussion] np.{bool,float,int} deprecation

2020-12-09 Thread Aaron Meurer
On Wed, Dec 9, 2020 at 9:41 AM Sebastian Berg wrote: > > On Mon, 2020-12-07 at 14:18 -0700, Aaron Meurer wrote: > > Regarding np.bool specifically, if you want to deprecate this, you > > might want to discuss this with us at the array API standard > > https://github.com/da

Re: [Numpy-discussion] np.{bool,float,int} deprecation

2020-12-07 Thread Aaron Meurer
np.bool to just be the boolean dtype object? Unlike int and float, there is no ambiguity with bool, and NumPy clearly doesn't have any issues with shadowing builtin names in its namespace. Aaron Meurer On Sat, Dec 5, 2020 at 4:31 PM Juan Nunez-Iglesias wrote: > > Hi all, > > At the

Re: [Numpy-discussion] Comment published in Nature Astronomy about The ecological impact of computing with Python

2020-11-24 Thread Aaron Meurer
the runtime for the majority of uses. And for instances where it isn't fast enough, e.g., when writing a looping algorithm directly, there are multiple tools that allow writing fast Python or Python-like code, such as Numba, Cython, Pythran, PyPy, and so on. Aaron Meurer On Tue, Nov 24, 2020 at 8:57 AM

Re: [Numpy-discussion] How did Numpy get its latest version of the documentation to appear at the top of Google search results?

2020-11-13 Thread Aaron Meurer
ot of good data on how people end up on your site via Google searches. Aaron Meurer On Fri, Nov 13, 2020 at 9:43 AM Ilhan Polat wrote: > > Have a look at here for "some" background > https://github.com/scipy/docs.scipy.org/issues/39 > > On Fri, Nov 13, 2020 at 5:3

Re: [Numpy-discussion] New package to speed up ufunc inner loops

2020-11-04 Thread Aaron Meurer
original discussion here, and since there's apparently no interest in improving the NEP wording, I'll drop it. Aaron Meurer ___ NumPy-Discussion mailing list NumPy-Discussion@python.org https://mail.python.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] New package to speed up ufunc inner loops

2020-11-04 Thread Aaron Meurer
quirements. Aaron Meurer On Wed, Nov 4, 2020 at 2:44 PM Ralf Gommers wrote: > > > > On Tue, Nov 3, 2020 at 3:54 PM Matti Picus wrote: >> >> Hi. On behalf of Quansight and RTOSHoldings, I would like to introduce >> "pnumpy", a package to speed up NumPy. >> &

Re: [Numpy-discussion] Allow __getitem__ to support custom objects

2020-10-30 Thread Aaron Meurer
On Fri, Oct 30, 2020 at 9:18 AM Sebastian Berg wrote: > > On Thu, 2020-10-29 at 23:58 -0600, Aaron Meurer wrote: > > On Thu, Oct 29, 2020 at 6:09 PM Sebastian Berg > > wrote: > > > On Tue, 2020-10-27 at 17:15 -0600, Aaron Meurer wrote: > > > > For ndind

Re: [Numpy-discussion] Allow __getitem__ to support custom objects

2020-10-29 Thread Aaron Meurer
On Thu, Oct 29, 2020 at 6:09 PM Sebastian Berg wrote: > > On Tue, 2020-10-27 at 17:15 -0600, Aaron Meurer wrote: > > For ndindex (https://quansight.github.io/ndindex/), the biggest issue > > with the API is that to use an ndindex object to actually index an > > array, y

[Numpy-discussion] Allow __getitem__ to support custom objects

2020-10-27 Thread Aaron Meurer
, or should I write a NEP? Aaron Meurer ___ NumPy-Discussion mailing list NumPy-Discussion@python.org https://mail.python.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] Request for comments on PEP 637 - Support for indexing with keyword arguments

2020-09-24 Thread Aaron Meurer
This PEP also opens the possibility of allowing a[] with nothing in the getitem. Has that been considered? Aaron Meurer On Thu, Sep 24, 2020 at 1:48 PM Sebastian Berg wrote: > On Wed, 2020-09-23 at 21:41 -0700, Stephan Hoyer wrote: > > On Wed, Sep 23, 2020 at 2:22 PM Stefa

Re: [Numpy-discussion] Why does fancy indexing work like this?

2020-08-24 Thread Aaron Meurer
On Wed, Aug 19, 2020 at 8:18 PM Sebastian Berg wrote: > > On Wed, 2020-08-19 at 19:37 -0600, Aaron Meurer wrote: > > These cases don't give any deprecation warnings in NumPy master: > > > > > > > np.arange(0)[np.array([0]), False] > > array([], dtype=int6

Re: [Numpy-discussion] What is up with raw boolean indices (like a[False])?

2020-08-20 Thread Aaron Meurer
On Thu, Aug 20, 2020 at 4:38 PM Sebastian Berg wrote: > > On Thu, 2020-08-20 at 16:00 -0600, Aaron Meurer wrote: > > Just to be clear, what exactly do you think should be deprecated? > > Boolean scalar indices in general, or just boolean scalars combined > > with other a

Re: [Numpy-discussion] What is up with raw boolean indices (like a[False])?

2020-08-20 Thread Aaron Meurer
Just to be clear, what exactly do you think should be deprecated? Boolean scalar indices in general, or just boolean scalars combined with other arrays, or something else? Aaron Meurer On Thu, Aug 20, 2020 at 3:56 PM Sebastian Berg wrote: > > On Thu, 2020-08-20 at 16:50 -0500, Sebastia

Re: [Numpy-discussion] What is up with raw boolean indices (like a[False])?

2020-08-20 Thread Aaron Meurer
or: shape mismatch: indexing arrays could not be broadcast together with shapes (1,5) (0,) That certainly seems to imply there is some broadcasting being done. Aaron Meurer On Wed, Aug 19, 2020 at 6:55 PM Sebastian Berg wrote: > > On Wed, 2020-08-19 at 18:07 -0600, Aaron Meurer wrote: > &

Re: [Numpy-discussion] Why does fancy indexing work like this?

2020-08-19 Thread Aaron Meurer
These cases don't give any deprecation warnings in NumPy master: >>> np.arange(0)[np.array([0]), False] array([], dtype=int64) >>> np.arange(0).reshape((0, 0))[np.array([0]), np.array([], dtype=int)] array([], dtype=int64) Is that intentional? Aaron Meurer On Thu, Jul 23

Re: [Numpy-discussion] What is up with raw boolean indices (like a[False])?

2020-08-19 Thread Aaron Meurer
tly like all other boolean arrays with no exceptions (i.e., work like np.nonzero(), broadcast, etc.). This would be less useful, but more consistent. Aaron Meurer ___ NumPy-Discussion mailing list NumPy-Discussion@python.org https://mail.python.org/mailman/listinfo/numpy-discussion

[Numpy-discussion] Use of booleans in slices

2020-08-13 Thread Aaron Meurer
terestingly, places that use a shape don't allow booleans (I guess they don't necessarily use __index__()?) >>> np.empty((True,)) Traceback (most recent call last): File "", line 1, in TypeError: an integer is required Aaron Meurer ___

Re: [Numpy-discussion] Why does fancy indexing work like this?

2020-07-23 Thread Aaron Meurer
non-deprecation-warning is raised when the error will only happen with > DeprecationWarnings being set to error. > > - Sebastian I noticed that warnings.catch_warnings does the right thing with warnings that are raised alongside an exception (although it is a bit clunk

Re: [Numpy-discussion] Why does fancy indexing work like this?

2020-07-22 Thread Aaron Meurer
nd of do this by making sure your fancy indices are always arrays. For the out of bounds one, it's a little harder. I guess for most use-cases, you aren't actually checking for IndexErrors, and the thing that will become an error usually indicates a bug in user code, so maybe it isn't a huge deal (I ad

Re: [Numpy-discussion] Why does fancy indexing work like this?

2020-07-22 Thread Aaron Meurer
On Wed, Jul 22, 2020 at 4:55 PM Aaron Meurer wrote: > > Ah, so I guess I caught this issue right as it got fixed. There are no > warnings in 1.19.0, but I can confirm I get the warnings in numpy > master. 1.19.1 isn't on conda yet, but I tried building it and didn't > get the warn

Re: [Numpy-discussion] Why does fancy indexing work like this?

2020-07-22 Thread Aaron Meurer
cycles like this tend to last (I'm also curious when the warnings for things like a[[[0, 1], [0, 1]]] will go away)? Aaron Meurer On Wed, Jul 22, 2020 at 4:32 PM Sebastian Berg wrote: > > On Wed, 2020-07-22 at 16:23 -0600, Aaron Meurer wrote: > > Why does fancy indexing have t

[Numpy-discussion] Why does fancy indexing work like this?

2020-07-22 Thread Aaron Meurer
ices (integer indices). I couldn't find any reference to this behavior in https://numpy.org/doc/stable/reference/arrays.indexing.html. Aaron Meurer ___ NumPy-Discussion mailing list NumPy-Discussion@python.org https://mail.python.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] What is up with raw boolean indices (like a[False])?

2020-07-06 Thread Aaron Meurer
> Its fully intentional as it is the correct generalization from an N-D > boolean index to include a 0-D boolean index. > To be fair, there is a footnote in the "Detailed notes" saying that: > "the nonzero equivalence for Boolean arrays does not hold for zero > dimensional boolean arrays.", this

[Numpy-discussion] What is up with raw boolean indices (like a[False])?

2020-07-06 Thread Aaron Meurer
tually be useful to be able to generically add length 0 axes using an index, similar to how `newaxis` adds a length 1 axis. Aaron Meurer ___ NumPy-Discussion mailing list NumPy-Discussion@python.org https://mail.python.org/mailman/listinfo/numpy-discussion