Argument mode order rules, Help

Pramod Kumar Singh pramod at tcsi.com
Wed Aug 9 16:18:12 EDT 2000


Hi,

  1. Here is my function header

   def OpOne(self, *args):
     return self.OpTwo(args)

  This works perfect.

  2. Now I want to change the function header to accept a keyword
argument _accessId=None. Thus I change the definition to.

   def OpOne(self, _accessId=None, *args):
      if _accessId is not None:
        # Do something creative with _accessId
      return self.OpTow(args)

  This gets compiled fine.

  3. Now in a function call, I use OpOne as follows.

     OpOne(123, _accessId=543)

     I get a error (TypeError: keyword parameter re-defined)

     This is expected by the rules of argument mode order, but how do I
get _accessId passed on to OpOne.  Is there any way to do this ?

  4. I've tried function definition as

     def OpOne(self, *args, _accessId=None, **kws)

     but this gives a syntax error.

  Any help appreciated.  Thanks,

Pramod/



More information about the Python-list mailing list