[IronPython] COM Object Issue

Vernon Cole vernondcole at gmail.com
Wed Nov 26 14:51:38 CET 2008


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> 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>:
> > 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/42dc03a8/attachment.html>


More information about the Ironpython-users mailing list