sum returns numpy.float64 when applied to a sequence of numpy.uint64

2012-12-15 Thread suzaku
I came across this question on StackOverflow today: http://stackoverflow.com/questions/13890451/why-numpy-sum-returns-a-float64-instead-of-an-uint64-when-adding-elements-of-a-g I'm not familiar with `numpy` but I'm curious about this, so I started doing some experiments. This is what I have dis

Re: Is `wsample` a proper name for a function like this?

2012-10-11 Thread suzaku
On Friday, October 12, 2012 10:22:16 AM UTC+8, Steven D'Aprano wrote: > On Wed, 10 Oct 2012 23:44:42 -0700, suzaku wrote: > > > > > I think if a programmer has used the built-in `random` module before, he > > > would expect a function with "sampl

Re: for-loop on cmd-line

2012-10-11 Thread suzaku
According to the document (http://docs.python.org/using/cmdline.html#interface-options), > When called with -c command, it executes the Python statement(s) given as > command. Here command may contain multiple statements separated by newlines. > Leading whitespace is significant in Python statem

Re: Is `wsample` a proper name for a function like this?

2012-10-10 Thread suzaku
On Thursday, October 11, 2012 2:29:37 PM UTC+8, Steven D'Aprano wrote: > On Wed, 10 Oct 2012 20:33:16 -0700, Satoru Logic wrote: > > > > > I came across a function named `wsample` in a `utils` package of my > > > workplace recently. > > > > > > The "w" in `wsample` stands for `weighted`, and