dimanche 14 juillet 2019

Choice random function from a class in Python

I have a calass with some functions, like this:

class valami:

    def a():
        *some code...*
    def b():
        *some code...*
    def c():
        *some code...*

I want to choice a random function from valami calss. I alredy triend this:

random.choice((valami.a(), valami.b(), valami.c()))

But it called all the functions at same time.




Aucun commentaire:

Enregistrer un commentaire