[Zope3-dev] Re: __init__.py interfaces.py guidelines?

Tres Seaver tseaver at palladion.com
Mon Nov 21 12:44:26 EST 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jean-Marc Orliaguet wrote:
> 
> There is another place where there seems to be two different patterns too:
> 
> sometimes we have:
> 
>   import zope.schema
>   name = zope.schema.TextLine(...)
> 
> and sometimes:
> 
>   from zope.schema import TextLine
>   name = TextLine(...)
> 
> any reason to use one or the other (speed, verbosity, avoiding circular
> imports, ...) ?

I vastly prefer the second:  it keeps the use points clearer, while
still making the source clear (the "*" key in my editor makes a great
way to find the import statement).

It is also ever-so-slightly faster, as it avoids a name lookup at
point-of-use.  That optimization is the source of only downside of the
practice:  it makes monkey-patching harder, because the original binding
gets copied.


Tres.
- --
===================================================================
Tres Seaver          +1 202-558-7113          tseaver at palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDggd6+gerLs4ltQ4RAm18AJ4uKFPnc6077pH9a4szCH7ZejYAKwCgmmPr
E4I59jfLbJck7T35inNkDSs=
=XwOH
-----END PGP SIGNATURE-----



More information about the Zope3-dev mailing list