diff options
author | Marion <marion.zepf@gmail.com> | 2013-08-23 09:48:31 (GMT) |
---|---|---|
committer | Marion <marion.zepf@gmail.com> | 2013-08-23 09:48:31 (GMT) |
commit | 54969017ae7836c371a61a862e8d35761076b06f (patch) | |
tree | 5bf5c7f542dcfd1c385b5c64137956449154d3ae | |
parent | 7bdbe864ade7916bedfc1c40c9f59ea355c4a00a (diff) |
make two utility functions for type checking less complicatedprimitive-class
-rw-r--r-- | TurtleArt/tautils.py | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/TurtleArt/tautils.py b/TurtleArt/tautils.py index 379a1d3..650f2ec 100644 --- a/TurtleArt/tautils.py +++ b/TurtleArt/tautils.py @@ -107,7 +107,7 @@ def chr_to_ord(x): ''' Try to comvert a string to an ord ''' if strtype(x) and len(x) == 1: try: - return ord(x[0]), True + return ord(x), True except ValueError: return x, False return x, False @@ -115,9 +115,7 @@ def chr_to_ord(x): def strtype(x): ''' Is x a string type? ''' - if isinstance(x, (str, unicode)): - return True - return False + return isinstance(x, basestring) def increment_name(name): |