On 19.03.13 06:45, Larry Hastings wrote: > 4. Store a string that looks like the Python declaration of the > signature, and parse it (Nick's suggestion). For foo above, this would > be "(arg,b=3,*,kwonly='a')". Length: 23 bytes. Strip parenthesis and it will be only 21 bytes long. > We'd want one more mild hack: the DSL will support positional > parameters, and inspect.Signature supports positional parameters, so > it'd be nice to render that information. But we can't represent that in > Python syntax (or at least not yet!), so we can't let ast.parse see it. > My suggestion: run it through ast.parse, and if it throws a SyntaxError > see if the problem was a slash. If it was, remove the slash, reprocess > through ast.parse, and remember that all parameters are positional-only > (and barf if there are kwonly, args, or kwargs). It will be simpler to use some one-character separator which shouldn't be used unquoted in the signature. I.e. LF.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4