Help needed to convert code from C# to Python.

Posted by Ali on Stack Overflow See other posts from Stack Overflow or by Ali
Published on 2009-02-12T19:42:23Z Indexed on 2010/06/02 13:53 UTC
Read the original article Hit count: 230

Filed under:
|
|
|

Can you please convert this code from C# to Python to be run on IronPython?

I don’t have any experience with Python.

using System;
using Baz;

namespace ConsoleApplication
{
  class Program
  {
    static void Main()
    {
        Portal foo = new Portal("Foo"); 
        Agent bar = new Agent("Bar");

        foo.Connect("127.0.0.1", 1234); 
        foo.Add(bar);

        bar.Ready += new Agent.ReadyHandler(bar_Ready);               
    }

    static void bar_Ready(object sender, string msg)
    {    
       Console.WriteLine(msg.body);  
    }
}
}

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET