-
-
Notifications
You must be signed in to change notification settings - Fork 126
Closed
Description
When using the EAN13() constructor with a 12 digit argument to create an EAN13, the check digit generated in the constructor is different than if you were to call calculate_checksum() on the 13 digit value returned by the constructor.
>>> EAN13("842169142322")
<EuropeanArticleNumber13('8421691423220')>
gives that the check digit is 0
>>> ean = EAN13("842169142322")
>>> ean
<EuropeanArticleNumber13('8421691423220')>
>>> ean.calculate_checksum()
4
implying that the check digit is 4
This seems to be due to the fact that when calculate_checksum() is called on a 13 digit EAN via the object itself, the reverse traversal that is used in the method includes the 13th digit when summing and calculating the check digit.
Metadata
Metadata
Assignees
Labels
No labels