Python COM and variable number of arguments

Stefan Schukat SSchukat at dspace.de
Fri Sep 20 16:41:59 CEST 2002


You just need the makepy generated wrapper and then you can 
just use named arguments:

Object.Add(Item,After=3)

Without the wrapper you are out of luck. 

	Stefan

> -----Original Message-----
> From: Greg Green [mailto:gregory.p.green at boeing.com]
> Sent: Thursday, September 19, 2002 10:36 PM
> To: python-list at python.org
> Subject: Python COM and variable number of arguments
> 
> 
> I am using python with a third-party closed source application. It has
> Visual Basic for Applications embedded in it for use as an extension
> language. My question is what to do about com calls that have a
> variable number of arguments in Visual Basic. It seems that I have to
> use all of the arguments when I call the method using python. But I
> don't know what to use for a value when I don't want that argument.
> 
> For instance, In VB i can call the method .Add with 1, 2, or 3
> arguments. The 2nd and 3rd arguments are optional. In this case the
> 2nd argument is called 'Before', and the 3rd is 'After'. So if I want
> to add an item after the 3rd item. I do: 
> 
>         .Add(Item,,3) 
> 
> In python I don't know what to use as the second argument:
> 
>         Object.Add(Item=Item,Before=????,After=3)
> 
> In case you are wondering, I have tried 'None', or leaving off the
> argument all together, but that doesn't work. :(
> 
> Thanks for any replies. This is causing me a lot of pain.
> 
> -- 
> 
> Greg Green
> 
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 




More information about the Python-list mailing list