[Numpy-discussion] Requesting a PR review for #5822

2016-06-09 Thread Antony Lee
https://github.com/numpy/numpy/pull/5822 is a year-old PR which allows many
random distributions to have a scale of exactly 0 (in which case a stream
of zeros is returned of whatever constant value is appropriate).
It passes all tests and has been sitting there for a while.  Would a core
dev be kind enough to have a look at it?
Thanks!
Antony
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
https://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] NumPy lesson at EuroScipy2016?

2016-06-09 Thread mail
Hi all,

Recently I taught "Advanced NumPy" lesson at a Software Carpentry workshop [1]. 
It covered a review of basic operations on numpy arrays and also more advanced 
topics: indexing, broadcasting, dtypes and memory layout. I would greatly 
appreciate your feedback on the lesson materials, which are available on github 
pages [2]. 

I am also thinking of proposing this lesson as a EuroScipy 2016 tutorial. Is 
anyone already planning to teach NumPy there? If so, would you be interested to 
team up for this lesson (as a co-instructor, helper or mentor)?

I gratefully acknowledge inspiration, some examples and exercises from the 
following materials:

- NumPy chapters of "SciPy lectures" by Emmanuelle Gouillart, Didrik Pinte, 
Gaƫl Varoquaux, and Pauli Virtanen [3]
- "Advanced NumPy patterns" by Juan Nunez-Iglesias [4]
- "The NumPy array. A structure for efficient numerical computation." by Stefan 
van der Walt [5]

Yours,

Bartosz

[1] http://telecom-python.telenczuk.pl
[2] https://paris-swc.github.io/advanced-numpy-lesson/
[3] http://www.scipy-lectures.org/
[4] https://github.com/jni/aspp2015/tree/delivered
[5] https://python.g-node.org/python-summerschool-2014/numpy.html
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
https://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Integers to integer powers, let's make a decision

2016-06-09 Thread Nathaniel Smith
On Mon, Jun 6, 2016 at 1:17 PM, Charles R Harris
 wrote:
>
>
>
> On Mon, Jun 6, 2016 at 2:11 PM, Marten van Kerkwijk 
>  wrote:
>>
>> Hi Chuck,
>>
>> I consider either proposal an improvement, but among the two I favour 
>> returning float for `**`, because, like for `/`, it ensures one gets closest 
>> to the (mathematically) true answer in most cases, and makes duck-typing 
>> that much easier -- I'd like to be able to do x** y without having to worry 
>> whether x and y are python scalars or numpy arrays of certain type.
>>
>> I do agree with Nathaniel that it would be good to check what actually 
>> breaks. Certainly, if anybody is up to making a PR that implements either 
>> suggestion, I'd gladly check whether it breaks anything in astropy.
>>
>> I  should add that I have no idea how to assuage the fear that new code 
>> would break with old versions of numpy, but on the other hand, I don't know 
>> its vailidity either, as it seems one either develops larger projects  for 
>> multiple versions and tests, or writes more scripty things for whatever the 
>> current versions are. Certainly, by this argument I better not start using 
>> the new `@` operator!
>>
>> I do think the argument that for division it was easier because there was 
>> `//` already available is a red herring: here one can use `np.power(a, b, 
>> dtype=...)` if one really needs to.
>
>
> It looks to me like users want floats, while developers want the easy path of 
> raising an error. Darn those users, they just make life sooo difficult...

I dunno, with my user hat on I'd be incredibly surprised / confused /
annoyed if an innocent-looking expression like

  np.arange(10) ** 2

started returning floats... having exact ints is a really nice feature
of Python/numpy as compared to R/Javascript, and while it's true that
int64 can overflow, there are also large powers that can be more
precisely represented as int64 than float.

-n

-- 
Nathaniel J. Smith -- https://vorpus.org
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
https://mail.scipy.org/mailman/listinfo/numpy-discussion