[Numpy-discussion] Re: Automatic formatters for only changed lines

2022-05-08 Thread Joshua Wilson
As someone who worked on a project that used to use yapf, a word of caution - regardless of quality of formatting versus black, it generally has not had the resources to keep up with new releases of Python. See https://github.com/google/yapf/issues/772 https://github.com/google/yapf/issues/993 htt

Re: [Numpy-discussion] sinpi/cospi trigonometric functions

2021-07-14 Thread Joshua Wilson
I'll note that SciPy actually does have `sinpi` and `cospi`-they just happen to be private: https://github.com/scipy/scipy/blob/master/scipy/special/functions.json#L58 https://github.com/scipy/scipy/blob/master/scipy/special/functions.json#L12 They are used extensively inside the module though as

Re: [Numpy-discussion] Ndarray static typing: Order of generic types

2020-11-01 Thread Joshua Wilson
> Just to speak for myself, I don't think the precise choice matters very much. > There are arguments for consistency both ways. I agree with this. In the absence of strong theoretical considerations I'd fall back to a practical one-we can make ndarray generic over dtype _right now_, while for sh

Re: [Numpy-discussion] Feelings about type aliases in NumPy

2020-05-09 Thread Joshua Wilson
noise. > > > On Sun, Apr 26, 2020 at 11:19 PM Joshua Wilson > wrote: >> >> To try and add some more data points to the conversation: >> >> > Maybe we can go for a bit more distant name like "numpy.annotations" or >> > whatever. >>

Re: [Numpy-discussion] Feelings about type aliases in NumPy

2020-04-26 Thread Joshua Wilson
>> >>> >>> >>> On Fri, Apr 24, 2020 at 11:31 AM Sebastian Berg >>> wrote: >>>> >>>> On Fri, 2020-04-24 at 11:10 -0700, Stefan van der Walt wrote: >>>> > On Fri, Apr 24, 2020, at 08:45, Joshua Wilson wrote: >&g

[Numpy-discussion] Feelings about type aliases in NumPy

2020-04-24 Thread Joshua Wilson
Hey everyone, Over in numpy-stubs we've been working on typing "array like": https://github.com/numpy/numpy-stubs/pull/66 It would be nice if the type were public so that downstream projects could use it (e.g. it would be very helpful in SciPy). Originally the plan was to only make it publicly a

[Numpy-discussion] Using scalar constructors to produce arrays

2020-04-19 Thread Joshua Wilson
Over in the NumPy stubs there's an issue https://github.com/numpy/numpy-stubs/issues/41 which points out that you can in fact do something like ``` np.float32([1.0, 0.0, 0.0]) ``` to construct an ndarray of float32. It seems to me that though you can do that, it is not a best practice, and one

Re: [Numpy-discussion] Put type annotations in NumPy proper?

2020-03-24 Thread Joshua Wilson
> That is, is this an all-or-nothing thing where as soon as we start, > numpy-stubs becomes unusable? Until NumPy is made PEP 561 compatible by adding a `py.typed` file, type checkers will ignore the types in the repo, so in theory you can avoid the all or nothing. In practice it's maybe trickier

Re: [Numpy-discussion] Converting np.sinc into a ufunc

2019-05-22 Thread Joshua Wilson
Re Ralf's question: > Can you quantify the precision improvement (approximately)? On one level you'll get a large decrease in relative error around the zeros of the sinc function because argument reduction is being done by a number which is exactly representable in double precision (i.e. the numb