docstrings m'fa'

This commit is contained in:
Paul Tagliamonte 2012-12-22 00:09:41 -05:00
parent 9c58c196c8
commit ae3f30b5e9
2 changed files with 14 additions and 2 deletions

View File

@ -1,6 +1,7 @@
#
import sys
from hy.lang.internals import HYNamespaceCOW
from hy.lang.string import HYString
def _define(obj, lns):
@ -17,10 +18,15 @@ def _loop(obj, lns):
arg.eval(lns.clone())
def _fn(obj, lns):
def _fn(obj, lns, name=None):
fd = obj.get_invocation()
args = fd['args']
sig = args[0]
docstring = None
if isinstance(args[1], HYString):
docstring = args.pop(1)
meth = args[1]
def _(*args, **kwargs):
@ -33,6 +39,12 @@ def _fn(obj, lns):
ret = m.eval(l, *args, **kwargs)
return ret
_.__name__ = "hyfn"
if name:
_.__name__ = name
_.__doc__ = docstring
return _

View File

@ -18,7 +18,7 @@ class HYExpression(HYObject, list):
return {
"function": fn,
"args": args
"args": args,
}
def peek(self):