[IronPython] [python] [IronPythonStudio] Namespace ClassesandAssembly Files

Pigneri, Rocco rpigneri at LavaStorm.com
Wed Jan 30 19:29:12 CET 2008


>Are you importing FormOne from FormTwo and/or vice versa?

No.  I have FormOne declared in one file and FormTwo declared in
another.  However, they are both in the same namespace (Forms).  I then
pull them into the Program.py form by using "from Form[One][Two] import
*".

>Pythonic namespace collisions are far less likely if you keep things in
their namespaces.  This is another way of saying that "from X import
>*" is potentially evil and should be used very carefully.  Try saying
"import FormOne" and then qualify the class as "FormOne.FormOne". 

So, then, is it correct to say that the namespace classes are not
namespaces at all (at least, not in the C# sense)?  In C#, I can declare
files in the same namespace in different files and then use them as a
group via Company.Namespace.Class1 and Company.Namespace.Class2.  It
sounds like instead, I need to do this:

import FormOne
import FormTwo

f  = FormOne.Forms.FormOne()
f2 = FormTWo.Forms.FormTwo()

Is this correct?

Rocco

-----Original Message-----
From: users-bounces at lists.ironpython.com
[mailto:users-bounces at lists.ironpython.com] On Behalf Of Curt
Hagenlocher
Sent: Wednesday, January 30, 2008 12:45 PM
To: Discussion of IronPython
Subject: Re: [IronPython] [python] [IronPythonStudio] Namespace
ClassesandAssembly Files

On Jan 30, 2008 9:25 AM, Pigneri, Rocco <rpigneri at lavastorm.com> wrote:
> Ah, ha!  I think I may have found the culprit!
>
> If I have the following import sequences in the follwing order, then 
> only FormTwo is available:
>
> from FormOne import *
> from FormTwo import *
>
> However, if they are in this order, then only FormOne is available:
>
> from FormTwo import *
> from FormOne import *
>
> It seems that only the last class statement that is evaluated/imported

> is retained.

Are you importing FormOne from FormTwo and/or vice versa?

Pythonic namespace collisions are far less likely if you keep things in
their namespaces.  This is another way of saying that "from X import *"
is potentially evil and should be used very carefully.  Try saying
"import FormOne" and then qualify the class as "FormOne.FormOne".

--
Curt Hagenlocher
curt at hagenlocher.org
_______________________________________________
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