I was wondering which of shuffle() and choice() was more efficient. For example, I have a N element list long_list and need a random item from the list, is it quicker to do:
shuffle(long_list)
return long_list[0]
or
return choice(long_list)
Aucun commentaire:
Enregistrer un commentaire