The following code:
from mimesis import Personal
person = Personal('en')
for _ in range(10):
print(person.identifier(mask='##-@@@-####'))
always prints the same identifiers. Sample output:
28-TKX-4789
28-TKX-4789
28-TKX-4789
28-TKX-4789
28-TKX-4789
28-TKX-4789
28-TKX-4789
28-TKX-4789
28-TKX-4789
28-TKX-4789
Whereas using Code.custom_code works fine:
from mimesis import Code
code = Code('en')
for _ in range(10):
print(code.custom_code(mask='##-@@@-####'))
Sample output:
842-RSM-5674
414-HKU-3804
580-DHM-0816
822-IWU-2176
467-NWU-5089
535-KVB-3492
319-VMF-7333
665-YEZ-4076
915-ZXQ-5384
861-BOB-4256
I think this is because Personal.identifier(...) returns Code(self.locale).custom_code(...), each time creating a new temporary Code object, rather than storing a Code object in it, code = Code(self.locale), and calling code.custom_code(...) for it.
I'll further test and send a PR if the problem is what I suspect it to be.
@faheel Seems like you're right. I'll wait for your PR. Thanks!
@faheel I think that we need to move custom_code() to utils.py as function, becuase it is use too often. And the creation of the Code() objects each time is inexpedient.
@faheel So, i have fixed this issue in branch type-hinting.