[IronPython] Odd behaviour from nested classes

Dino Viehland dinov at exchange.microsoft.com
Wed Jul 5 19:00:35 CEST 2006


Thanks for the bug report, I've opened CodePlex bug 779 - this is similar to another issue we saw recently but I don't think we fixed the type case.

-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Jonathan Jacobs
Sent: Monday, July 03, 2006 2:54 PM
To: Discussion of IronPython
Subject: [IronPython] Odd behaviour from nested classes

Hi,

I just found some incredibly strange behaviour when using nested C# classes.
Here's the repro:

Test.cs:
namespace Test {
     public class Aye {
         public class AyeBee {
         }
     }
}

hax/__init__.py:
import clr
clr.AddReferenceToFile('Test.dll')

 >>> import hax
 >>> import Test
 >>> Test.Aye
<type 'Aye'>
 >>> Test.Aye.AyeBee
Traceback (most recent call last):
   File , line 0, in <stdin>##15
AttributeError: type object 'Aye' has no attribute 'AyeBee'
 >>> import clr
 >>> Test.Aye.AyeBee
<type 'AyeBee'>

The trick here is hax/__init__.py, if I reference the assembly "manually" then the problem ceases to exist. I'm not sure whether this is a quirk of nested classes or the clr module itself.

Regards
--
Jonathan

When you meet a master swordsman,
show him your sword.
When you meet a man who is not a poet,
do not show him your poem.
                 -- Rinzai, ninth century Zen master _______________________________________________
users mailing list
users at lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com



More information about the Ironpython-users mailing list