Closed 4kpt closed 6 years ago
@4kpt You can't create two similar telephones when you create two instances. Theoretical it is possible, but the probability is very small.
You can use following format, which is much easier, because here no need create two instances of Personal
:
>>> from mimesis import Personal
>>> per = Personal('en')
>>> a = b = per.telephone('+#-(###)-###-####')
>>> a == b
True
Or, maybe this decision does not suit for you? If not, why?
I need two different telephones like work phone and home phone. How can i get it?
@4kpt There are bug with generating telephone by mask which has been fixed in version 1.0.0
. I'll publish new version in next week.
Try use this:
>>> from mimesis import Code
>>> code = Code()
>>> a = code.custom_code('+#-(###)-###-####')
>>> b = code.custom_code('+#-(###)-###-####')
>>> a
'+3-(289)-022-8253'
>>> b
'+3-(504)-942-9931'
>>>
We have seriously improved the library in version 1.0.0
and these inconveniences should pay off by clearer API.
But i need use usa-specific phone number like Person("en").telephone... Why create new Person instance return old person telephone?
@4kpt We have discussed why in #286. It's a bug related to code.Code.custom_code
: details.
@4kpt If you are really really need usa-specific phone numbers, then you can use this workaround:
>>> import random
>>> from mimesis import Personal, Code
>>> code = Code()
>>> masks = Personal('en').data['telephone_fmt']
>>> a = code.custom_code(mask=random.choice(masks))
Thanks.