Mercurial > hg > pyloader
changeset 77:efb7a8a189e8
update comments/docstring
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Thu, 09 Jun 2011 18:40:52 -0700 |
parents | 1339185cbd2d |
children | 2449fb4a89c1 |
files | pyloader/cast.py pyloader/invoke.py |
diffstat | 2 files changed, 15 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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"""
--- 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