namespaces in python

Martin v. Löwis loewis at informatik.hu-berlin.de
Tue Jul 16 04:30:31 EDT 2002


Jeff Davis <jdavis at empires.org> writes:

> 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? 

Certainly. Just bind the function in that other namespace.

> Is there a way to have static methods that don't require
> instantiating the object first?

In Python 2.2, there is the "staticmethod" builtin. For earlier Python
versions, it is common to put the static methods next to the class,
instead of inside the class.

Regards,
Martin



More information about the Python-list mailing list