BJörn Lindqvist <[EMAIL PROTECTED]> writes: > It's a stylistic issue, so everyone must have an opinion, so here's > mine: I think from turbogears import * is bad style because you can't > see just by looking at the function name from where the function comes > from. > > @turbogears.expose(template=...) > def index(...) > > is much clearear than > > @expose(template=...) > def index(...)
Agreed. That's what I use as well. > Which leaves you guessing on what expose() it is. cherrypy.expose()? > I'd prefer if the module names was a little shorter instead: > > @gears.expose(template=....) > > My personal preferences is to use "import modulename" when modulename > contains mostly functions and "from modulename import someclass, > someotherclass" when I want to use classes from modulename. Just my > two cents, I can't say my style is better than anyone elses. Same thing here. I only import specific classes when they will be used a lot or when the fully qualified name will be too big. For example I use: import turbogears from turbogears import identity from turbogears import validators @identity.require(...) @turbogears.validate(validators = {..:validators.Int()} or from turbogears.i18n import format format.format_date(...) format.format_currency(...) or, in the specific case, sometimes I do: from turbogears.i18n.format import format_date, format_currency format_date(...) format_currency(...) But I prefer importing just the top level. -- Jorge Godoy <[EMAIL PROTECTED]>