On 2007-06-08, Stebanoid <[EMAIL PROTECTED]> wrote:
> On 8, 00:07, Dustan <[EMAIL PROTECTED]> wrote:
>> On Jun 7, 1:30 pm, Neil Cerutti <[EMAIL PROTECTED]> wrote:
>>
>> > On 2007-06-07, Stebanoid <[EMAIL PROTECTED]> wrote:
>>
>> > > if you have a list of functions you can try this:
>>
>> > > im
On 8, 00:07, Dustan <[EMAIL PROTECTED]> wrote:
> On Jun 7, 1:30 pm, Neil Cerutti <[EMAIL PROTECTED]> wrote:
>
> > On 2007-06-07, Stebanoid <[EMAIL PROTECTED]> wrote:
>
> > > if you have a list of functions you can try this:
>
> > > import random
> > > import math
> > > m[int(math.floor(len(m)*r
On 2007-06-07, Dustan <[EMAIL PROTECTED]> wrote:
> On Jun 7, 1:30 pm, Neil Cerutti <[EMAIL PROTECTED]> wrote:
>> On 2007-06-07, Stebanoid <[EMAIL PROTECTED]> wrote:
>>
>> > if you have a list of functions you can try this:
>>
>> > import random
>> > import math
>> > m[int(math.floor(len(m)*random.r
On Jun 7, 1:30 pm, Neil Cerutti <[EMAIL PROTECTED]> wrote:
> On 2007-06-07, Stebanoid <[EMAIL PROTECTED]> wrote:
>
> > if you have a list of functions you can try this:
>
> > import random
> > import math
> > m[int(math.floor(len(m)*random.random()))]() # seems like Lisp
>
> Or rather m[random.ran
On 2007-06-07, Stebanoid <[EMAIL PROTECTED]> wrote:
> if you have a list of functions you can try this:
>
> import random
> import math
> m[int(math.floor(len(m)*random.random()))]() # seems like Lisp
Or rather m[random.randint(0, len(m))]()
--
Neil Cerutti
Caution: Cape does not enable user to
On 7, 19:56, David Bear <[EMAIL PROTECTED]> wrote:
> I would like to write some code that would randomly select a function from a
> list of functions and call it. I was looking in the globals names space and
> randomly selecting items that were of type function.. but I didn't see a
> way of act
On 7, 19:56, David Bear <[EMAIL PROTECTED]> wrote:
> I would like to write some code that would randomly select a function from a
> list of functions and call it. I was looking in the globals names space and
> randomly selecting items that were of type function.. but I didn't see a
> way of act
On 7 jun, 11:56, David Bear <[EMAIL PROTECTED]> wrote:
> I would like to write some code that would randomly select a function from a
> list of functions and call it. I was looking in the globals names space and
> randomly selecting items that were of type function.. but I didn't see a
> way of act
On Jun 7, 10:56 am, David Bear <[EMAIL PROTECTED]> wrote:
> I would like to write some code that would randomly select a function from a
> list of functions and call it. I was looking in the globals names space and
> randomly selecting items that were of type function..
Careful!!! You don't want t
How are you making the list of functions? Something like this:
[code]
fs = []
for k,f in globals():
if callable(f):
fs.append(f)
[/code]
Then to call a random one (assuming they all take no parameters):
[code]
import random
random.choice(fs)()
[/code]
Or maybe you only have the name
In <[EMAIL PROTECTED]>, David Bear wrote:
> I would like to write some code that would randomly select a function from a
> list of functions and call it. I was looking in the globals names space and
> randomly selecting items that were of type function.. but I didn't see a
> way of actually runnin
David Bear said unto the world upon 06/07/2007 11:56 AM:
> I would like to write some code that would randomly select a function from a
> list of functions and call it. I was looking in the globals names space and
> randomly selecting items that were of type function.. but I didn't see a
> way of a
I would like to write some code that would randomly select a function from a
list of functions and call it. I was looking in the globals names space and
randomly selecting items that were of type function.. but I didn't see a
way of actually running the function.
Any pointers?
--
David Bear
-- l
13 matches
Mail list logo