<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>
Dino and Jeff,<BR>&nbsp;<BR>Thanks alot, that helped alot. I was going crazy trying to step thru the code. <BR>&nbsp;<BR>Danny<br>&nbsp;<BR><div><div id="SkyDrivePlaceholder"></div><hr id="stopSpelling">From: dinov@microsoft.com<br>To: fernandez_dan2@hotmail.com; ironpython-users@python.org<br>Subject: RE: [Ironpython-users] type for unicode and str<br>Date: Wed, 1 Feb 2012 17:54:48 +0000<br><br>


<meta name="Generator" content="Microsoft SafeHTML">


<style>
.ExternalClass p.ecxMsoNormal, .ExternalClass li.ecxMsoNormal, .ExternalClass div.ecxMsoNormal
{margin-bottom:.0001pt;font-size:12.0pt;font-family:"Times New Roman","serif";}
.ExternalClass a:link, .ExternalClass span.ecxMsoHyperlink
{color:blue;text-decoration:underline;}
.ExternalClass a:visited, .ExternalClass span.ecxMsoHyperlinkFollowed
{color:purple;text-decoration:underline;}
.ExternalClass p
{margin-right:0in;margin-left:0in;font-size:12.0pt;font-family:"Times New Roman","serif";}
.ExternalClass span.ecxEmailStyle18
{font-family:"Calibri","sans-serif";color:#1F497D;}
.ExternalClass .ecxMsoChpDefault
{font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;}
.ExternalClass div.ecxWordSection1
{page:WordSection1;}

</style>


<div class="ecxWordSection1">
<p class="ecxMsoNormal"><span style='color: rgb(31, 73, 125); font-family: "Calibri","sans-serif"; font-size: 11pt;'>Jeff answered the Unicode/str part, so I’ll answer the following code part.&nbsp; Ultimately these come from the properties in Builtin.cs:</span></p>
<p class="ecxMsoNormal"><span style='color: rgb(31, 73, 125); font-family: "Calibri","sans-serif"; font-size: 11pt;'>&nbsp;</span></p>
<p class="ecxMsoNormal"><span style='color: rgb(31, 73, 125); font-family: "Calibri","sans-serif"; font-size: 11pt;'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public static PythonType unicode {</span></p>
<p class="ecxMsoNormal"><span style='color: rgb(31, 73, 125); font-family: "Calibri","sans-serif"; font-size: 11pt;'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; get {</span></p>
<p class="ecxMsoNormal"><span style='color: rgb(31, 73, 125); font-family: "Calibri","sans-serif"; font-size: 11pt;'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return DynamicHelpers.GetPythonTypeFromType(typeof(string));</span></p>
<p class="ecxMsoNormal"><span style='color: rgb(31, 73, 125); font-family: "Calibri","sans-serif"; font-size: 11pt;'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></p>
<p class="ecxMsoNormal"><span style='color: rgb(31, 73, 125); font-family: "Calibri","sans-serif"; font-size: 11pt;'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></p>
<p class="ecxMsoNormal"><span style='color: rgb(31, 73, 125); font-family: "Calibri","sans-serif"; font-size: 11pt;'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public static PythonType str {</span></p>
<p class="ecxMsoNormal"><span style='color: rgb(31, 73, 125); font-family: "Calibri","sans-serif"; font-size: 11pt;'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; get {</span></p>
<p class="ecxMsoNormal"><span style='color: rgb(31, 73, 125); font-family: "Calibri","sans-serif"; font-size: 11pt;'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return DynamicHelpers.GetPythonTypeFromType(typeof(string));</span></p>
<p class="ecxMsoNormal"><span style='color: rgb(31, 73, 125); font-family: "Calibri","sans-serif"; font-size: 11pt;'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></p>
<p class="ecxMsoNormal"><span style='color: rgb(31, 73, 125); font-family: "Calibri","sans-serif"; font-size: 11pt;'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></p>
<p class="ecxMsoNormal"><span style='color: rgb(31, 73, 125); font-family: "Calibri","sans-serif"; font-size: 11pt;'>&nbsp;</span></p>
<p class="ecxMsoNormal"><span style='color: rgb(31, 73, 125); font-family: "Calibri","sans-serif"; font-size: 11pt;'>Ultimately we produce a PythonModule which has a PythonDictionary.&nbsp; All of our dictionaries have a storage class which abstracts way how the dictionary is actually
 implemented.&nbsp; For built-in modules we have a ModuleDictionaryStorage object.&nbsp; The ModuleDictionaryStorage lazily reflects over the module type and caches the result.&nbsp; For properties it’ll pull the value out the first time it’s accessed.</span></p>
<p class="ecxMsoNormal"><span style='color: rgb(31, 73, 125); font-family: "Calibri","sans-serif"; font-size: 11pt;'></span></p>
<div style="border-width: medium medium medium 1.5pt; border-style: none none none solid; border-color: currentColor currentColor currentColor blue; padding: 0in 0in 0in 4pt;">
<div>
<div style="border-width: 1pt medium medium; border-style: solid none none; border-color: rgb(181, 196, 223) currentColor currentColor; padding: 3pt 0in 0in;">
<p class="ecxMsoNormal"><b><span style='font-family: "Tahoma","sans-serif"; font-size: 10pt;'>From:</span></b><span style='font-family: "Tahoma","sans-serif"; font-size: 10pt;'> ironpython-users-bounces+dinov=microsoft.com@python.org [mailto:ironpython-users-bounces+dinov=microsoft.com@python.org]
<b>On Behalf Of </b>Daniel Fernandez<br>
<b>Sent:</b> Tuesday, January 31, 2012 8:55 PM<br>
<b>To:</b> ironpython-users@python.org<br>
<b>Subject:</b> [Ironpython-users] type for unicode and str</span></p>
</div>
</div>
<p class="ecxMsoNormal">&nbsp;</p>
<div>
<p class="ecxMsoNormal"><span style='font-family: "Tahoma","sans-serif"; font-size: 10pt;'>Hi All,<br>
&nbsp;<br>
I was just playing with unicode strings and I notice a difference with CPython and IronPython. On CPython 2.7.2 I get the following<br>
&nbsp;<br>
&gt;&gt;&gt; type(u"A")<br>
&lt;type 'unicode'&gt;<br>
&gt;&gt;&gt; type("A")<br>
&lt;type 'str'&gt;<br>
&nbsp;<br>
On Ironpython the latest 2.7.2 Alpha 1 I get the following<br>
&nbsp;<br>
&gt;&gt;&gt; type(u"A")<br>
&lt;type 'str'&gt;<br>
&gt;&gt;&gt; type("A")<br>
&lt;type 'str'&gt;<br>
&nbsp;<br>
&nbsp;<br>
I decided to crack open the source and see where this type function is defined. I followed to the builtin.cs with the PythonModule but I got kind lost there. If anyone can provide some helpful hints that would be great.<br>
&nbsp;<br>
Thanks<br>
&nbsp;<br>
Danny</span></p>
</div>
</div>
</div></div>                                               </div></body>
</html>