Skip to content

Instantly share code, notes, and snippets.

@uchan-nos
Created February 21, 2013 06:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uchan-nos/5002606 to your computer and use it in GitHub Desktop.
Save uchan-nos/5002606 to your computer and use it in GitHub Desktop.
def str_collection(obj):
if isinstance(obj, list):
if len(obj) > 0:
result = ['[', str(obj[0])]
for o in obj[1:]:
result.append(', ')
result.append(o.__str__())
result.append(']')
return ''.join(result)
return obj.__str__()
str = str_collection
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment