Mercurial > hg > pyloader
comparison pyloader/invoke.py @ 77:efb7a8a189e8
update comments/docstring
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Thu, 09 Jun 2011 18:40:52 -0700 |
parents | a825f00fe062 |
children | 36f5d31c3ed6 |
comparison
equal
deleted
inserted
replaced
76:1339185cbd2d | 77:efb7a8a189e8 |
---|---|
3 from cast import cast | 3 from cast import cast |
4 from cast import str2args | 4 from cast import str2args |
5 | 5 |
6 def strcall(obj, *args, **kwargs): | 6 def strcall(obj, *args, **kwargs): |
7 """call a thing with string arguments""" | 7 """call a thing with string arguments""" |
8 | |
9 # TODO: | |
10 # could have modes for casting, at least for intrinsic types | |
11 # - optimistic: try to cast everything '1' -> 1 | |
12 # - argument-based: only cast what's in the arguments | |
13 # - you should also be able to provide your own casts | |
14 # This will have to be made an object in order to actually do this | |
15 # so that these parameters may be provided to __init__ | |
16 | |
8 inspected = obj | 17 inspected = obj |
9 if inspect.isclass(obj): | 18 if inspect.isclass(obj): |
10 inspected = obj.__init__ # inspect the ctor | 19 inspected = obj.__init__ # inspect the ctor |
11 try: | 20 try: |
12 argspec = inspect.getargspec(inspected) | 21 argspec = inspect.getargspec(inspected) |