[IronPython] Some new bugs with asssembly loading...
Keith J. Farmer
kfarmer at thuban.org
Thu Jan 5 12:43:08 CET 2006
If you don't want all classes in an assembly loaded, then use something other than *.
I don't view an assembly as fundamentally different in use from a Python dll. You can import both, and add their namespaces to the global namespace. You use path to specify where the packages may be found -- not where a namespace may be found. I would actually argue that sys.path is not an appropriate approach given the pre-existing rules for loading assemblies.
from pythonLib import * .. searches sys.path for pythonLib, and imports the namespace therein
from (assembly reference) import * .. uses .NET assembly resolution rules to locate the correct assembly, and imports the namespaces therein
As far as merged namespaces, that is effectively a requirement -- see all the bits under System.* that aren't in the same file. Multi-file assemblies also exist and need to be accounted for. Those, plus the localization, versioning, and security features of strong-name referencing, lead me to believe that referencing by strong name is a better direction than specifying the assembly's filename.
From: users-bounces at lists.ironpython.com on behalf of xtian
Sent: Thu 1/5/2006 2:13 AM
I don't think that would work very well - assemblies and namespaces
are orthogonal. The Python equivalent to adding a reference to an
assembly is adding a path (or an egg or zip) to sys.path.
That's important, because an assembly can contain many different
namespaces (in the same way an egg can contain multiple packages or
modules, although it's not quite equivalent). You wouldn't necessarily
want all of the classes in an assembly to be imported into the global
The main difference is that if you have two assemblies that expose the
same namespace, when you do a using statement for that namespace,
you'll have all of the members of the namespaces in both assemblies
available, while in Python, you'd get only the members of the module
that was first on the path. There are pluses and minuses for both
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 5073 bytes
Desc: not available
More information about the Ironpython-users