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

2005-11-22 Thread Martijn Faassen
Gary Poster wrote: On Nov 21, 2005, at 12:29 PM, 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 =

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

2005-11-22 Thread Dominik Huber
Martijn Faassen wrote: I don't think using any of these patterns is a big style problem (I'm much less opinionated about this than about code in __init__.py); it's hard to recommend a single practice, so perhaps we shouldn't. +1 Regards, Dominik begin:vcard fn:Dominik Huber n:Huber;Dominik

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

2005-11-22 Thread Jim Fulton
Gary Poster wrote: On Nov 21, 2005, at 12:29 PM, 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 =

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

2005-11-22 Thread Dieter Maurer
Jim Fulton wrote at 2005-11-21 09:43 -0500: ... A Python convention is that a leading underscore indicates privateness. - what about import paths inside a same package: relative or absolute? from mypackage.interfaces import ISomeInterface or: from interfaces import ISomeInterface

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

2005-11-21 Thread Martijn Faassen
Hi there, Jean-Marc Orliaguet wrote: are there any guidelines / best practises for setting the contents of __init__.py, interfaces.py, and the packages that they import or that they expose? there are too many alternatives and too many ways of ending up doing circular imports and I'd like to

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

2005-11-21 Thread Janko Hauser
Am 21.11.2005 um 12:15 schrieb Martijn Faassen: My recommendations for any guidelines would be: * use namespace packages, so nothing (or very minimal stuff only, like a few imports) in __init__.py. I think this is recommended practice outside of Zope 3 as well, so we should stick with

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

2005-11-21 Thread Jim Fulton
Martijn Faassen wrote: Hi there, Jean-Marc Orliaguet wrote: are there any guidelines / best practises for setting the contents of __init__.py, interfaces.py, and the packages that they import or that they expose? there are too many alternatives and too many ways of ending up doing circular

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

2005-11-21 Thread Jim Fulton
Janko Hauser wrote: Am 21.11.2005 um 12:15 schrieb Martijn Faassen: My recommendations for any guidelines would be: * use namespace packages, so nothing (or very minimal stuff only, like a few imports) in __init__.py. I think this is recommended practice outside of Zope 3 as well, so we

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

2005-11-21 Thread Jean-Marc Orliaguet
Martijn Faassen wrote: Hi there, Hi Martijn, Jean-Marc Orliaguet wrote: some packages have an interfaces.py file others have a interfaces folder, others have the interface definitions in the implementation code itself ... The pattern changed over time during Zope 3 development. In my

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

2005-11-21 Thread Jean-Marc Orliaguet
OK, so to summarize this thread: - __init__.py files are empty unless for the convenient import of other modules located in the same package or in a subpackage? - public interfaces are stored in interfaces.py - private interfaces are written along with the implementation code - what

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

2005-11-21 Thread Jim Fulton
Jean-Marc Orliaguet wrote: OK, so to summarize this thread: - __init__.py files are empty unless for the convenient import of other modules located in the same package or in a subpackage? Actually, primarily for convenient import by external packages. - public interfaces are stored

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

2005-11-21 Thread Jean-Marc Orliaguet
Jim Fulton wrote: Jean-Marc Orliaguet wrote: OK, so to summarize this thread: - __init__.py files are empty unless for the convenient import of other modules located in the same package or in a subpackage? Actually, primarily for convenient import by external packages. yes

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

2005-11-21 Thread Jim Fulton
Jean-Marc Orliaguet wrote: Jim Fulton wrote: Jean-Marc Orliaguet wrote: OK, so to summarize this thread: - __init__.py files are empty unless for the convenient import of other modules located in the same package or in a subpackage? Actually, primarily for convenient import by

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

2005-11-21 Thread Martijn Faassen
Jean-Marc Orliaguet wrote: OK, so to summarize this thread: - __init__.py files are empty unless for the convenient import of other modules located in the same package or in a subpackage? I'm typically okay with this, though I suspect it can in some cases lead to circular imports you

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

2005-11-21 Thread Jean-Marc Orliaguet
Jim Fulton wrote: yes indeed, but no cross imports between packages that are siblings. Huh? Why? I'm not at all sure I know what you mean. the question is what relation between the importer and the imported are OK: if I add such imports in __init__.py, I should only import from

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

2005-11-21 Thread Jim Fulton
Jean-Marc Orliaguet wrote: Jim Fulton wrote: yes indeed, but no cross imports between packages that are siblings. Huh? Why? I'm not at all sure I know what you mean. the question is what relation between the importer and the imported are OK: if I add such imports in __init__.py, I

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

2005-11-21 Thread Jean-Marc Orliaguet
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

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

2005-11-21 Thread Gary Poster
On Nov 21, 2005, at 12:29 PM, 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(...)