```
def permute(self, nums):
def permutations(nums):
if not nums:
yield []
for n in nums:
for permut in permutations([i for i in nums if i != n]):
yield [n] + permut
return [permut for permut in permutations(nums)]
```