Skip to content

Commit 29727b9

Browse files
authored
Merge pull request #64 from svisser/py3_version_info
Avoid use of sys.version for checking Python version
2 parents 0f3aa87 + 4515e5b commit 29727b9

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

nameparser/parser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def __unicode__(self):
134134
return " ".join(self)
135135

136136
def __str__(self):
137-
if sys.version >= '3':
137+
if sys.version_info[0] >= 3:
138138
return self.__unicode__()
139139
return self.__unicode__().encode(self.encoding)
140140

@@ -151,7 +151,7 @@ def __repr__(self):
151151
'suffix': self.suffix or '',
152152
'nickname': self.nickname or '',
153153
}
154-
if sys.version >= '3':
154+
if sys.version_info[0] >= 3:
155155
return _string
156156
return _string.encode(self.encoding)
157157

nameparser/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def emit(self, record):
1313

1414

1515
import sys
16-
if sys.version < '3':
16+
if sys.version_info[0] < 3:
1717

1818
text_type = unicode
1919
binary_type = str

0 commit comments

Comments
 (0)