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

2005-11-22 Thread Benji York
Jim Fulton wrote: Dieter Maurer wrote: Jim Fulton wrote at 2005-11-21 09:43 -0500: Absolute always. Until the Python import mechanism is fixed, *always* use absolute imports. But, this will make refactoring (moving modules around in the package hierarchy) more difficult. It only makes mo

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

2005-11-22 Thread Jim Fulton
Dieter Maurer wrote: 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

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 ISomeI

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 = T

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 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 = T

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(...) FWIW,

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 circul

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

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 m

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 exte

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 indeed,

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 in

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

2005-11-21 Thread Dominik Huber
Jean-Marc Orliaguet wrote: OK, so to summarize this thread: - __init__.py files are empty One ore two years ago garett raised a similar issue too. IMO (Excuse me, I could not find the mail) then we decided to import the interfaces.py within __init__.py: from interfaces import * Regards,

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 abo

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

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

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

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

2005-11-21 Thread Jean-Marc Orliaguet
Hi! 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 have a consistent pattern for red