From 54969017ae7836c371a61a862e8d35761076b06f Mon Sep 17 00:00:00 2001 From: Marion Date: Fri, 23 Aug 2013 09:48:31 +0000 Subject: make two utility functions for type checking less complicated --- 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): -- cgit v0.9.1