Fredrik Tolf wrote:
> On Mon, 2006-03-06 at 20:25 -0800, James Stroud wrote:
>
>>Fredrik Tolf wrote:
>>
>>>If I have a variable which points to a function, can I check if certain
>>>argument list matches what the function wants before or when calling it?
>>>
>>>Currently, I'm trying to catch a Typ
Fredrik Tolf wrote:
> On Mon, 2006-03-06 at 20:25 -0800, James Stroud wrote:
>
>>Fredrik Tolf wrote:
>>
>>>If I have a variable which points to a function, can I check if certain
>>>argument list matches what the function wants before or when calling it?
>>>
>>>Currently, I'm trying to catch a Typ
Fredrik Tolf wrote:
> # ...
> if callable(f):
> try:
> f(*cv[1:])
> except TypeError:
> self.reply("err", "argno")
> # ...
>
> However, this results in bugs in the server code that would cause
> TypeError to reply to the client that it had the wrong number of args,
> and I
On Mon, 2006-03-06 at 20:25 -0800, James Stroud wrote:
> Fredrik Tolf wrote:
> > If I have a variable which points to a function, can I check if certain
> > argument list matches what the function wants before or when calling it?
> >
> > Currently, I'm trying to catch a TypeError when calling the
If you have access to the source of the function you want to call (and know
what kind of data types it wants in its args) you can raise something else for
bad parameters, eg:
class ArgTypeError(TypeError):
def __init__(self, ar
Roy Smith wrote:
> Fredrik Tolf wrote:
> >If I have a variable which points to a function, can I check if certain
> >argument list matches what the function wants before or when calling it?
> >
> >Currently, I'm trying to catch a TypeError when calling the function
> >(since that is what is rais
Fredrik Tolf wrote:
>If I have a variable which points to a function, can I check if certain
>argument list matches what the function wants before or when calling it?
>
>Currently, I'm trying to catch a TypeError when calling the function
>(since that is what is raised when trying to call it with
James Stroud wrote:
(snip)
> Since python is "weakly typed",
s/weakly/dynamically/
(snip)
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])"
--
http://mail.python.org/mailman/listinfo/python-list
Jay Parlar wrote:
>
> On Mar 6, 2006, at 8:44 PM, James Stroud wrote:
>
>> Since python is "weakly typed", you will not be able to check what
>> "type" of arguments a function expects. TypeErrors relating to the
>> type of argemtns you pass will be raised inside the function only and
>> not wh
On Mar 6, 2006, at 8:44 PM, James Stroud wrote:
> Since python is "weakly typed", you will not be able to check what
> "type" of arguments a function expects. TypeErrors relating to the
> type of argemtns you pass will be raised inside the function only and
> not when it is called. I.e. there
Fredrik Tolf wrote:
> If I have a variable which points to a function, can I check if certain
> argument list matches what the function wants before or when calling it?
>
> Currently, I'm trying to catch a TypeError when calling the function
> (since that is what is raised when trying to call it w
I will be out of the office from March 3rd to March 31st.
In urgent cases please contact [EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
You can match if the list contains the legal number of arguments with.
func_variable.func_code.co_argcount
Type checking arguments has to be done manually since Python is a
dynamic language. Perhaps, you could try some typechecking decorators.
http://www.ilowe.net/software/typecheck/
>From the doc
If I have a variable which points to a function, can I check if certain
argument list matches what the function wants before or when calling it?
Currently, I'm trying to catch a TypeError when calling the function
(since that is what is raised when trying to call it with an illegal
list), but that
14 matches
Mail list logo