[python-win32] Indexing COM Objects

Mark Hammond mhammond@skippinet.com.au
Tue, 8 Apr 2003 08:59:15 +1000


Com object pointers have a rule on how to test for identity, and win32com
supports it.

So ob._oleobj_ == ob2._oleobj_ will return true if the exact same underlying
pointer is used for both objects.  id() of these objects will *not*.

Mark.

> -----Original Message-----
> From: python-win32-admin@python.org
> [mailto:python-win32-admin@python.org]On Behalf Of Erignac, Charles A
> Sent: Thursday, 27 March 2003 8:24 AM
> To: Bob Gailer; python-win32@python.org
> Subject: RE: [python-win32] Indexing COM Objects
>
>
> I manipulate COM objects through their Python wrapper (static
> dispatch). Supposing that myObject is such an object, would
> id(myObject._oleobj_) return a unique key to the underlying COM object?
> In other words, if I cast myObject into another wrapper class as in
> 	myOtherObject = Cast(myObject,myOtherClass)
> would  myOtherObject._oleobj_ be the same object as myObject._oleobj_?
>
> Charles
>
> -----Original Message-----
> From: Bob Gailer [mailto:bgailer@alum.rpi.edu]
> Sent: Wednesday, March 26, 2003 12:36 PM
> To: Erignac, Charles A; python-win32@python.org
> Subject: Re: [python-win32] Indexing COM Objects
>
>
> At 12:03 PM 3/26/2003 -0800, Erignac, Charles A wrote:
> >I would like to use COM objects as keys for a dictionary. It seems that
> >they do not have the indexing property. Is one of their property
> a unique
> >indexable key?
>
> AFAIK that's a nono. What are you trying to accomplish? Perhaps there's a
> workaround.
>
> Bob Gailer
> PLEASE NOTE NEW EMAIL ADDRESS bgailer@alum.rpi.edu
> 303 442 2625
>
> _______________________________________________
> Python-win32 mailing list
> Python-win32@python.org
> http://mail.python.org/mailman/listinfo/python-win32