[IronPython] Good example of with statement usage in IronPython/COM

2007-10-27 Thread Sanghyeon Seo
I found this interesting blog post which has a good example of with
statement (Python 2.5 feature) usage in IronPython/COM.

http://d.hatena.ne.jp/akiramei/20071026/1193419839

It's written in Japanese, but the code speaks for itself. The last
line would translate to something like It's getting shorter, but
nesting is a bit too deep...

-- 
Seo Sanghyeon
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Good example of with statement usage in IronPython/COM

2007-10-27 Thread Shri Borde
There was a leak in IronPython where we were keeping COM objects alive once the 
IPy code manipulated the COM object. The code in the blog seems to be dealing 
with this bug with the use of the auto method which calls 
Marshal.ReleaseComObject in the finally. The bug is fixed in the 2.0 tree and 
so it should be possible to shorten the code a lot and end up with just a few 
levels of nesting.

Shri

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Sanghyeon Seo
Sent: Saturday, October 27, 2007 8:10 PM
To: Discussion of IronPython
Subject: [IronPython] Good example of with statement usage in IronPython/COM

I found this interesting blog post which has a good example of with
statement (Python 2.5 feature) usage in IronPython/COM.

http://d.hatena.ne.jp/akiramei/20071026/1193419839

It's written in Japanese, but the code speaks for itself. The last
line would translate to something like It's getting shorter, but
nesting is a bit too deep...

--
Seo Sanghyeon
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Good example of with statement usage in IronPython/COM

2007-10-27 Thread Sanghyeon Seo
2007/10/28, Shri Borde [EMAIL PROTECTED]:
 There was a leak in IronPython where we were keeping COM objects alive once 
 the IPy code manipulated the COM object. The code in the blog seems to be 
 dealing with this bug with the use of the auto method which calls 
 Marshal.ReleaseComObject in the finally. The bug is fixed in the 2.0 tree and 
 so it should be possible to shorten the code a lot and end up with just a few 
 levels of nesting.

Oops, it was a bug then.

-- 
Seo Sanghyeon
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Good example of with statement usage in IronPython/COM

2007-10-27 Thread Shri Borde
Well, still a good use of with for an elegant workaround :)

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Sanghyeon Seo
Sent: Saturday, October 27, 2007 10:44 PM
To: Discussion of IronPython
Subject: Re: [IronPython] Good example of with statement usage in IronPython/COM

2007/10/28, Shri Borde [EMAIL PROTECTED]:
 There was a leak in IronPython where we were keeping COM objects alive once 
 the IPy code manipulated the COM object. The code in the blog seems to be 
 dealing with this bug with the use of the auto method which calls 
 Marshal.ReleaseComObject in the finally. The bug is fixed in the 2.0 tree and 
 so it should be possible to shorten the code a lot and end up with just a few 
 levels of nesting.

Oops, it was a bug then.

--
Seo Sanghyeon
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com