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

2012-10-10 Thread Satoru Logic
I came across a function named `wsample` in a `utils` package of my workplace recently. The "w" in `wsample` stands for `weighted`, and it randomly selects an element from a container according to relative weights of all the elements. In most articles and codes I saw online, a function like thi

Re: how can i check whether a variable is iterable in my code?

2008-09-20 Thread satoru
thanks very much! -- http://mail.python.org/mailman/listinfo/python-list

Re: how can i check whether a variable is iterable in my code?

2008-09-20 Thread satoru
On Sep 20, 6:35 pm, Aidan <[EMAIL PROTECTED]> wrote: > satoru wrote: > > hi, all > > i want to check if a variable is iterable like a list, how can i > > implement this? > > this would be one way, though I'm sure others exist: > > if hasattr(yourVar,

how can i check whether a variable is iterable in my code?

2008-09-20 Thread satoru
hi, all i want to check if a variable is iterable like a list, how can i implement this? -- http://mail.python.org/mailman/listinfo/python-list

Re: Confounded by Python objects

2008-07-24 Thread satoru
On Jul 24, 6:10 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On Jul 24, 11:59 am, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > > > tip: if you're not 100% sure why you would want to put an attribute > > on the class level, don't do it. > > The reason I did it was sort of C++ish (that's where

Re: why is "self" used in OO-Python?

2008-07-13 Thread satoru
On Jul 13, 12:32 am, ssecorp <[EMAIL PROTECTED]> wrote: > I first learned about OO from Java. > > I much prefer to program in Python though. > > However I am consufed about 2 things. > > 1. Why do I have to pass self into every method in a class? Since I am > always doing why cant this be automated

Re: site-packages, unzipepd there but import fails

2008-07-04 Thread satoru
why don't you just download & excute the windown installer binary? On Jul 4, 2:47 am, defn noob <[EMAIL PROTECTED]> wrote: > On Jul 3, 8:06 pm, "[EMAIL PROTECTED]" > > <[EMAIL PROTECTED]> wrote: > > On 3 juil, 18:51, defn noob <[EMAIL PROTECTED]> wrote: > > > > well the reason i unzipped and place