Explanation: for the built-in sum(), the second argument is the starting value. For numpy's sum(), the second argument is the axis (-1 means "last axis") If you're ready to blame numpy for messing things up, keep in mind that numpy's sum predated Python's
-
-
Show this threadThanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
@jakevdp woah, I had no idea. That helped me catch a bug I was havingThanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
@jakevdp@brandon_rhodes Thanks for the reminder but you're only an idiot if you do that. -
@mtrier But some libraries are *designed* for `import *` interactive use — the alternative is a tedious 100-item import. Just not NumPy :)
End of conversation
New conversation -
-
-
@jakevdp@prashanthsriram I'm curious (not much of a Python user) what's the reason for this behaviour? -
@ExpectAPatronum@jakevdp@prashanthsriram Function is set with most recent import overwriting python's in-built sum func with np's. - Show replies
New conversation -
-
-
.
@jakevdp Yep, wildcard imports should be avoided (as specified in PEP 8), thanks for the reminder! SO explains why:https://stackoverflow.com/questions/2386714/why-is-import-bad …Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
This Tweet is unavailable.
-
- Show replies
-
-
-
@tarek_ziade@jakevdp An `import *`, happily, doesn’t touch the builtins or what they mean in other modules—just shadows them locally.Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.