<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:st1="urn:schemas-microsoft-com:office:smarttags" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]--><o:SmartTagType
 namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="PersonName"/>
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:blue;
        text-decoration:underline;}
p
        {mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman";}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:Tahoma;
        color:green;
        font-weight:normal;
        font-style:normal;
        text-decoration:none none;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>

</head>

<body lang=EN-US link=blue vlink=blue>

<div class=Section1>

<p class=MsoNormal><font size=2 color=green face=Tahoma><span style='font-size:
10.0pt;font-family:Tahoma;color:green'>I actually want to use an object
instance of a .NET custom class that I pass in before the script is invoked
from c#.&nbsp; Our current scripts look something like:<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=green face=Tahoma><span style='font-size:
10.0pt;font-family:Tahoma;color:green'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=green face=Tahoma><span style='font-size:
10.0pt;font-family:Tahoma;color:green'>row.PropertySet[&#8220;Foo&#8221;][&#8220;Bar&#8221;].Value
= x<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=green face=Tahoma><span style='font-size:
10.0pt;font-family:Tahoma;color:green'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=green face=Tahoma><span style='font-size:
10.0pt;font-family:Tahoma;color:green'>and it would be much better if script
authors could write:<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=green face=Tahoma><span style='font-size:
10.0pt;font-family:Tahoma;color:green'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=green face=Tahoma><span style='font-size:
10.0pt;font-family:Tahoma;color:green'>row.Foo.Bar = x<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=green face=Tahoma><span style='font-size:
10.0pt;font-family:Tahoma;color:green'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=green face=Tahoma><span style='font-size:
10.0pt;font-family:Tahoma;color:green'>So I&#8217;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. <o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=green face=Tahoma><span style='font-size:
10.0pt;font-family:Tahoma;color:green'><o:p>&nbsp;</o:p></span></font></p>

<div>

<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>

<hr size=2 width="100%" align=center tabindex=-1>

</span></font></div>

<p class=MsoNormal><b><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>From:</span></font></b><font size=2
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'> users-bounces@lists.ironpython.com
[mailto:users-bounces@lists.ironpython.com] <b><span style='font-weight:bold'>On
Behalf Of </span></b>Miha Valencic<br>
<b><span style='font-weight:bold'>Sent:</span></b> Thursday, November 06, 2008
9:08 AM<br>
<b><span style='font-weight:bold'>To:</span></b> <st1:PersonName w:st="on">Discussion
 of IronPython</st1:PersonName><br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: [IronPython]
Extension methods in python</span></font><o:p></o:p></p>

</div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='margin-bottom:12.0pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>Marty, from what I
understand you are passing a variable into python engine and want extension
methods there? You can use something like that:<br>
<br>
import clr<br>
import System<br>
<br>
class MyString(System.String):<br>
&nbsp; pass;<br>
<br>
&nbsp; def ToFoo(self):<br>
&nbsp;&nbsp;&nbsp; return self.upper()+' FooBarBaz'<br>
<br>
<br>
a = MyString(&quot;Hello world!&quot;);<br>
print a.ToFoo();<br>
<br>
<br>
<br>
That would print &quot;HELLO WORLD! FooBarBaz.<br>
<br>
You can't put methods on System.String though, but you can create new object
from System.String...<br>
<br>
Miha<o:p></o:p></span></font></p>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>2008/11/5 Marty Nelson &lt;<a href="mailto:Marty.Nelson@symyx.com">Marty.Nelson@symyx.com</a>&gt;<o:p></o:p></span></font></p>

<div link=blue vlink=purple>

<div>

<p><font size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>Is
there the equivalent of extension method in python?&nbsp; I want to put a
variable into the script scope and create extension methods for it.&nbsp; Does
this make sense and is it possible?</span></font><o:p></o:p></p>

</div>

</div>

</div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p>&nbsp;</o:p></span></font></p>

</div>

</body>

</html>

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