from faker import Faker
fake = Faker()
def test_faker():
for _ in range(20):
print(fake.unique.ascii_free_email())
That's what fake.unique does. The UniqueProxy wraps every fake method with a decorator that ensures that within this run that each value is only ever returned once. See https://github.com/joke2k/faker/blob/master/faker/proxy.py