P
Paolino
While it's not so bad we can bind names in the module namespace, (ex
writing scripts ?) ,writing modules is someway bound to not polluting
that namespace (really IMO).
For non-functions we can use 'class' :
class ns:
foo='something'
but writing a function there triggers the binding to 'self' behaviour.
The straight solution is @staticmethod
class ns:
@staticmethod
def gulp(*args):
pass
Another solution is via metaclass
class namespaceMeta(type):
def __init__(cls,*more):
## wrap all methods with staticmethod()
class namespace:
__metaclass__=namespaceMeta
class ns(namespace):
def gulp(*args)
ass
This solution makes me think the keyword 'namespace' is missing:
namespace ns:
foo='something'
def gulp(*args):
pass
Solutions and comments appreciated.
Regards Paolino
___________________________________
Yahoo! Messenger: chiamate gratuite in tutto il mondo
http://it.beta.messenger.yahoo.com
writing scripts ?) ,writing modules is someway bound to not polluting
that namespace (really IMO).
For non-functions we can use 'class' :
class ns:
foo='something'
but writing a function there triggers the binding to 'self' behaviour.
The straight solution is @staticmethod
class ns:
@staticmethod
def gulp(*args):
pass
Another solution is via metaclass
class namespaceMeta(type):
def __init__(cls,*more):
## wrap all methods with staticmethod()
class namespace:
__metaclass__=namespaceMeta
class ns(namespace):
def gulp(*args)
This solution makes me think the keyword 'namespace' is missing:
namespace ns:
foo='something'
def gulp(*args):
pass
Solutions and comments appreciated.
Regards Paolino
___________________________________
Yahoo! Messenger: chiamate gratuite in tutto il mondo
http://it.beta.messenger.yahoo.com