Add code comment

This commit is contained in:
Glandos 2018-12-22 15:29:31 +01:00 committed by GitHub
parent e37b3fb7d3
commit 0b8b3e679a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -29,6 +29,9 @@ class TagInfo(namedtuple("_TagInfo", "value name type length enum")):
cls, value, name, type, length, enum or {})
def cvt_enum(self, value):
# Using get will call hash(value), which can be expensive
# for some types (e.g. Fraction). Since self.enum is rarely
# used, it's usually better to test it first.
return self.enum.get(value, value) if self.enum else value