<mattip>
cpython wants to encode the encoding into ascii
<mattip>
s/ascii/utf-8/
lessshaste has joined #pypy
leshaste has quit [Read error: Connection reset by peer]
lehmrob has joined #pypy
Cheery_ is now known as Cheery
lehmrob has quit [Ping timeout: 246 seconds]
Atque has quit [Ping timeout: 255 seconds]
Atque has joined #pypy
<Hodgestar>
mattip: I have no idea. :)
<Hodgestar>
mattip: I guess the correct answer is "sanitise the encoding string before trying to use it", but I like UnicodeDecodeError a bit more than UnicodeEncodeError (encoding the encoding seems like an implementation detail that breaks the simple mental model of "decoding should raise decoding errors").
sol_ has quit [Read error: Connection reset by peer]
<mattip>
yeah, it confused me too until I looked at the implementation of `unicode_decode`
<lessshaste>
numpy is so confusing. np.sum(A) is twice as slow as A.sum()
sol__ has joined #pypy
<mattip>
what is A.shape, A.dtype ?
<lessshaste>
mattip, just tried with a bigger example
<lessshaste>
In [11]: A.shape
<lessshaste>
Out[11]: (10000,)
<lessshaste>
In [12]: A.dtype
<lessshaste>
Out[12]: dtype('float64')
Julian has joined #pypy
<mattip>
small examples suffer from the overhead of np.asarray(A) inside np.sum
<lessshaste>
does 10,000 count as small?
<mattip>
basically np.sum(A) is "np.asarray(A).sum() but it has dispatching to allow __array_function__ overrides
<lessshaste>
but what is np.asarray(A) doing given that it is already an numpy array?
<mattip>
this override code has been moved to C to make it faster in the dev version of numpy