Skip to content

Instantly share code, notes, and snippets.

@Slater-Victoroff
Created August 9, 2013 14:19
Show Gist options
  • Save Slater-Victoroff/6193947 to your computer and use it in GitHub Desktop.
Save Slater-Victoroff/6193947 to your computer and use it in GitHub Desktop.
The most functional line of python
def random_document(document_layout, type, **kwargs):
document_layout.append("dummy_item")
doc = lambda l:{l[i]:doc(l[i+1]) if isinstance(l[i+1],list) else random_item(type,**kwargs) for i in range(len(l)-1)}
return doc(document_layout)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment