By custom class you mean a class you've written?  And then you want it to 
"light up" with dynamic languages?

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Marty Nelson
Sent: Thursday, November 06, 2008 7:18 PM
To: Discussion of IronPython
Subject: Re: [IronPython] Extension methods in python

I actually want to use an object instance of a .NET custom class that I pass in 
before the script is invoked from c#.  Our current scripts look something like:

row.PropertySet["Foo"]["Bar"].Value = x

and it would be much better if script authors could write:

row.Foo.Bar = x

So I'm looking to have an on the fly function read the metadata of expected 
keys and then code generated python class wrapper for the script author to 
consume.

________________________________
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Miha Valencic
Sent: Thursday, November 06, 2008 9:08 AM
To: Discussion of IronPython
Subject: Re: [IronPython] Extension methods in python

Marty, from what I understand you are passing a variable into python engine and 
want extension methods there? You can use something like that:

import clr
import System

class MyString(System.String):
  pass;

  def ToFoo(self):
    return self.upper()+' FooBarBaz'


a = MyString("Hello world!");
print a.ToFoo();



That would print "HELLO WORLD! FooBarBaz.

You can't put methods on System.String though, but you can create new object 
from System.String...

Miha
2008/11/5 Marty Nelson <[EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>>

Is there the equivalent of extension method in python?  I want to put a 
variable into the script scope and create extension methods for it.  Does this 
make sense and is it possible?

=======
Notice: This e-mail message, together with any attachments, contains
information of Symyx Technologies, Inc. or any of its affiliates or
subsidiaries that may be confidential, proprietary, copyrighted,
privileged and/or protected work product, and is meant solely for
the intended recipient. If you are not the intended recipient, and
have received this message in error, please contact the sender
immediately, permanently delete the original and any copies of this
email and any attachments thereto.


_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to