Python calculate arrangements of sequence
Notes


I'd expect arrangements to return the unique permutations of sequence, not just how many there are.
If it returns a number, it should be an integer.
You could use collections.Counter instead of counting the integers again and again.
You're right, it would be nice to have itertools.unique_permutations. In the meantime, I often come back to this SO answer.


Possible refactoring

from math import factorial
from functools import reduce
from collections import Counter
from operator import mul


def count_unique_permutations(sequence):
    count_permutations = factorial(len(sequence))
    repetitions = (factorial(v) for v in Counter(sequence).values())
    return count_permutations // reduce(mul, repetitions)