문제

why does IronPython allow, to import two enums with the same name from different namespaces, for example:

from System.Windows *
from ESS.MS.Framework.UIG.Mask import *

Both import the enum WindowState with different members.

It seems, that some time IronPython pick the right enum and some times not. Very confusing... (IronPython 2.7.4)

Thank you!

도움이 되었습니까?

해결책

You should define an alias:

from System.Windows import WindowState as WindowState1
from ESS.MS.Framework.UIG.Mask import WindowState as WindowState2

or for the entire module

import System.Windows as Module1
import ESS.MS.Framework.UIG.Mask as Module2

//...
Module1.WindowState
Module2.WindowState

PS. choose of course better aliases

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top