# HG changeset patch # User Jeff Hammel # Date 1307670052 25200 # Node ID efb7a8a189e80562b038357c6d9155c9b112de32 # Parent 1339185cbd2dac33158742da650e89658b63c65e update comments/docstring diff -r 1339185cbd2d -r efb7a8a189e8 pyloader/cast.py --- a/pyloader/cast.py Thu Jun 09 18:34:27 2011 -0700 +++ b/pyloader/cast.py Thu Jun 09 18:40:52 2011 -0700 @@ -1,3 +1,9 @@ +#!/usr/bin/env python + +""" +cast strings to python objects +""" + class StringCastException(Exception): """raised on unsucessful cast""" diff -r 1339185cbd2d -r efb7a8a189e8 pyloader/invoke.py --- a/pyloader/invoke.py Thu Jun 09 18:34:27 2011 -0700 +++ b/pyloader/invoke.py Thu Jun 09 18:40:52 2011 -0700 @@ -5,6 +5,15 @@ def strcall(obj, *args, **kwargs): """call a thing with string arguments""" + + # TODO: + # could have modes for casting, at least for intrinsic types + # - optimistic: try to cast everything '1' -> 1 + # - argument-based: only cast what's in the arguments + # - you should also be able to provide your own casts + # This will have to be made an object in order to actually do this + # so that these parameters may be provided to __init__ + inspected = obj if inspect.isclass(obj): inspected = obj.__init__ # inspect the ctor