Skip to content

Instantly share code, notes, and snippets.

@AstraLuma
Created January 7, 2014 21:17
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 AstraLuma/8307064 to your computer and use it in GitHub Desktop.
Save AstraLuma/8307064 to your computer and use it in GitHub Desktop.
This is an idea for a method of defining function bodies inside of eg: JSON properties, special files, or other methods. Inspired by a dislike of existing CouchDB query servers for python. Implemented as an ast post-processor.
import os
import sys
# Approximate
def _generated_function_name(**__args__):
spam = __args__['spam']
eggs = __args__['eggs']
del __args__
return os.path.exists(os.path.join(spam, eggs))
from __args__ import spam, eggs
import os
import sys
return os.path.exists(os.path.join(spam, eggs))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment