[IronPython] COM Object Issue

Dino Viehland dinov at microsoft.com
Wed Nov 26 20:11:07 CET 2008


I wouldn't expect any breaking changes in COM until IronPython 3.0 at the earliest.  That being said our COM binding logic is actually owned by the DLR team.  They have been and will continue working on fixing bugs in the COM binding logic.  Therefore you might see us integrate in small bug fixes but nothing that would break your code.

I think ideally we'd all love to see us match pywin32 as closely as possible so we might at some point revisit the way we currently are doing the binding (and recent changes in the DLR should make this much easier than it was before).  I think we'd approach this by enabling both behaviors so .Item works as well as calling, eventually start issuing warnings on .Item, and then finally remove .Item in Ipy 3k or later.
________________________________
From: users-bounces at lists.ironpython.com [users-bounces at lists.ironpython.com] On Behalf Of Vernon Cole [vernondcole at gmail.com]
Sent: Wednesday, November 26, 2008 7:51 AM
To: Discussion of IronPython
Subject: Re: [IronPython] COM Object Issue

That's a really fine question. I had to change all of my COM item access twice now in adodbapi. I finally ended up using a function, because iron python and c python are so different in this area. My current code is:
if onIronPython:
    def getIndexedValue(obj,index):
        return obj.Item[index]
else: #pywin32
   def getIndexedValue(obj,index):
        return obj(index)

So I can (for example, reading the field definitions of an ADO recordset):

            nOfFields=rs.Fields.Count
            for i in range(nOfFields):
                f=getIndexedValue(rs.Fields,i)

Question: Will this continue to work in future versions of IronPython?
--
Vernon Cole

On Wed, Nov 26, 2008 at 2:50 AM, Zaur Shibzoukhov <szport at gmail.com<mailto:szport at gmail.com>> wrote:
What will happen with the item-like access to COM objects in IP 2.0?

Whether it will return to []-like access (as in RC 1) or it will
remain .Item(...)?
IMHO RC 1 way is more preferred.

Best regards,
Zaur

2008/10/27 Dino Viehland <dinov at microsoft.com<mailto:dinov at microsoft.com>>:
> Oh, and I'm not sure if this is by design or not (I'll need to ping the DLR team), but it seems you can do:
>
> wd.Variables.Item('foo')
>
> instead.
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20081126/e372025f/attachment.html>


More information about the Ironpython-users mailing list