Skip to content

Instantly share code, notes, and snippets.

@jtallieu
Last active September 12, 2016 18:35
Show Gist options
  • Save jtallieu/4c08bcf0963b9f8cd53e0dd710872dde to your computer and use it in GitHub Desktop.
Save jtallieu/4c08bcf0963b9f8cd53e0dd710872dde to your computer and use it in GitHub Desktop.
Eagle Eye Networks Inc :: Python screening sample - String handling optimization
"""
::Eagle Eye Networks Inc.:::
::Python screening::
The following script is purposley written poorly.
Improve upon the code and explain your improvements.
The id_csv method must return a unicode string of
representation of a comma separated list of uuid's
"""
import uuid
import string
import cProfile
def id_csv(limit):
"""Generates a comma separated list of uuid's"""
id_list = u""
while limit:
limit -= 1
id_list += str(uuid.uuid4())
if limit:
id_list += ", "
return id_list
if __name__ == "__main__":
print id_csv(10)
cProfile.run("id_csv(10000)")
@thartley
Copy link

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment