17 lines
316 B
Python
17 lines
316 B
Python
from random import shuffle
|
|
|
|
|
|
def immutable_to_list(immutable, scramble=False, prune=0):
|
|
indices = list(range(len(immutable)))
|
|
if scramble:
|
|
shuffle(indices)
|
|
|
|
python_list = [immutable[i] for i in indices]
|
|
|
|
if prune > 0:
|
|
del python_list[prune:]
|
|
|
|
return python_list
|
|
|
|
|