[python-win32] Re: Desire information about Invoke and InvokeTypes

Mark Hammond mhammond at skippinet.com.au
Tue Apr 20 18:56:16 EDT 2004


> So the docs also have swapped the typeDesc and the resultTypeDesc
> arguments.  It should read
>   InvokeTypes(dispid, lcid, wFlags, resultTypeDesc, typeDesc, args)
> instead.

Thanks!  I just fixed that.

> > Is it possible you are tripping over us calling the
> 'default' method or
> > property in some cases?  eg:, I could imagine:
> >
> > sc = chart.SeriesCollection()
> > n = sc.Add(series_range, seriesAddDirection)
> > print n
> >
> > would print '1' in certain cases.  However:
> > print repr(n)
> >
> > Would make it more obvious.  It is possible the object has
> a 'default'
> > property that is called whenever str() or int() is called
> on the object.
>
> I also was bugged by this behaviour some time ago.  Confusing, imo.

Yes, I tend to agree, but am stuck between a rock and a hard place.  Many
samples, especially VB based ones often show code like:

f = whatever.GetField()
MsgBox "The field " & field & " has value " & field.Value

Or even passing the object to a function that expects a string.  They make
no reference at all to what the "implied" attribute name they are using is,
or when passing as a param, make no reference to the behaviour.

I believe Excel Cells and many other objects work this way, and COM goes to
lengths to define the semantics.  Just like COM's INVOKE_PROPERTYPUTREF, it
is one of those things that I would prefer didn't exist, but feel I can't
ignore them given they do.

Mark.




More information about the Python-win32 mailing list