Jeff answered the Unicode/str part, so I'll answer the following code part.  
Ultimately these come from the properties in Builtin.cs:

        public static PythonType unicode {
            get {
                return DynamicHelpers.GetPythonTypeFromType(typeof(string));
            }
        }
        public static PythonType str {
            get {
                return DynamicHelpers.GetPythonTypeFromType(typeof(string));
            }
        }

Ultimately we produce a PythonModule which has a PythonDictionary.  All of our 
dictionaries have a storage class which abstracts way how the dictionary is 
actually implemented.  For built-in modules we have a ModuleDictionaryStorage 
object.  The ModuleDictionaryStorage lazily reflects over the module type and 
caches the result.  For properties it'll pull the value out the first time it's 
accessed.
From: ironpython-users-bounces+dinov=microsoft....@python.org 
[mailto:ironpython-users-bounces+dinov=microsoft....@python.org] On Behalf Of 
Daniel Fernandez
Sent: Tuesday, January 31, 2012 8:55 PM
To: ironpython-users@python.org
Subject: [Ironpython-users] type for unicode and str

Hi All,

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

>>> type(u"A")
<type 'unicode'>
>>> type("A")
<type 'str'>

On Ironpython the latest 2.7.2 Alpha 1 I get the following

>>> type(u"A")
<type 'str'>
>>> type("A")
<type 'str'>


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.

Thanks

Danny
_______________________________________________
Ironpython-users mailing list
Ironpython-users@python.org
http://mail.python.org/mailman/listinfo/ironpython-users

Reply via email to