namespaces in python
Alex Martelli
aleax at aleax.it
Tue Jul 16 04:54:55 EDT 2002
Jeff Davis wrote:
> Is there a way to put functions and variables in a different namespace
> without putting it in a seperate file or instantiating a new object? Is
Yes, class scope being an example.
> there a way to have static methods that don't require instantiating the
> object first?
class Namespace(object):
def afunction(): print 'here'
afunction = staticmethod(afunction)
Namespace.afunction()
> I just want a clean way to divide up my modules a bit without cluttering
> up the filesystem (or requiring seperate i/o operations to fetch several
> files).
"import-from-zipfile" is another interesting possibility, but it's
not part of standard Python right now -- still, you can install it,
see e.g. http://www.mcmillan-inc.com/iu.html
Alex
More information about the Python-list
mailing list