Namespaces
Andy Gimblett
gimbo at ftech.net
Tue Apr 16 07:12:33 EDT 2002
On Tue, Apr 16, 2002 at 08:52:29PM +1000, Graeme Matthew wrote:
> import Template
> template = Template.Template()
>
> I cannot get it to instantiate like
>
> template = Template()
template = Template.Template() is the correct way to do it.
You could do what you want with:
from Template import *
template = Template()
but such "namespace pollution" is generally seen as a bad thing (see
http://py-howto.sourceforge.net/doanddont/doanddont.html for more on
this). Slightly less harmful would be:
from Template import Template
template = Template()
but really you're doing the right thing anyway - don't knock it. :-)
-Andy
--
Andy Gimblett - Programmer - Frontier Internet Services Limited
Tel: 029 20 820 044 Fax: 029 20 820 035 http://www.frontier.net.uk/
Statements made are at all times subject to Frontier's Terms and
Conditions of Business, which are available upon request.
More information about the Python-list
mailing list