You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
some special currencies like ```XXX``. Enumerants names are lowercase
This creates 2 issues:
A syntactic one - in Python syntactic conventions are that enum members shall be uppercase
A computational one - if one wants to check if a currency code exists in the enum without triggering a not-found exception, the proper way is to use Currency.__members__.get(code) and check its return value for None. However the current convention requires first to convert the code to lowercase just to be able to lookup the code
Changing the convention to uppercase automatically eliminates these 2 issues, plus simplifies the code (call to lower() useless now).
The text was updated successfully, but these errors were encountered:
That's a good point, but it wouldn't be that easy to change the casing due to backwards compatibility. I'm going to add a new function to address the second issue.
if one wants to check if a currency code exists in the enum without triggering a not-found exception, the proper way is to use Currency.__members__.get(code) and check its return value for None.
Just passing by, but note this isn't the proper way to check if an enum value (rather than key) is present, instead use
This python doc indicates that enumerant names are lowercase:
iso4217/iso4217/__init__.py
Line 108 in 7a546bb
This creates 2 issues:
Currency.__members__.get(code)
and check its return value for None. However the current convention requires first to convert the code to lowercase just to be able to lookup the codeChanging the convention to uppercase automatically eliminates these 2 issues, plus simplifies the code (call to lower() useless now).
The text was updated successfully, but these errors were encountered: