Permalink
Browse files

Merge pull request #35 from Met48/unicode-usage

Fix for issue #34, unicode docstring.
  • Loading branch information...
2 parents 84abe40 + 68984f5 commit 67d2a4a7fecf0538007cfd86e4d5a687c7a3b717 @keleshev keleshev committed Jun 26, 2012
Showing with 8 additions and 1 deletion.
  1. +8 −1 docopt.py
View
@@ -2,6 +2,13 @@
import re
+#Python 3 Compatibility
+try:
+ basestring
+except NameError:
+ basestring = str
+
+
class DocoptLanguageError(Exception):
"""Error in construction of usage-message by developer."""
@@ -259,7 +266,7 @@ def match(self, left, collected=None):
class TokenStream(list):
def __init__(self, source, error):
- self += source.split() if type(source) is str else source
+ self += source.split() if isinstance(source, basestring) else source
self.error = error
def move(self):

0 comments on commit 67d2a4a

Please sign in to comment.