[IronPython] Two Questions: C# "using" statements & MSH/Monad

Dino Viehland dinov at exchange.microsoft.com
Fri Mar 3 21:57:48 CET 2006


Unfortunately on #1 you'll need to setup a try/finally block:

try:
        # use some object
finally:
        some_object.Dispose()

I'm not sure about #2.


Do you want to help develop Dynamic languages on CLR? (http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F0-45DF-8B78-DC1B43134038)

-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Shawn Wheatley
Sent: Friday, March 03, 2006 12:46 PM
To: Discussion of IronPython
Subject: [IronPython] Two Questions: C# "using" statements & MSH/Monad

Hi all,

Thanks to Martin Maly, I got my first IronPython application up and
running. However, I could not figure out how to translate a "using"
statement into python syntax:

using(some_object)
{
   ...
}

where "some_object" is garbage collected when no longer used. I don't
know of a similar construct in Python (except for "with", coming in
Python 2.5, which obviously isn't supported in IronPy... it's not even
out yet!)

Any ideas?


Question #2:
Has anybody worked with the System.Management.Automation namespace in
IronPython? I'd love to try to work in the power of the MSH cmdlets
with the syntax of Python. I got a simple example from the MSH
documentation online:

http://tinyurl.com/lnqdt

Unfortunately, there is no good documentation on the whole namespace,
so I'm hacking around with it right now, trying to figure out how to
create Commands and pass I/O back and forth. If anybody has tried this
with IronPython, please let me know.

Thanks!
Shawn Wheatley
_______________________________________________
users mailing list
users at lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com



More information about the Ironpython-users mailing list