Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #32691

Re: How to improve the usability of nested packages

From Michael Schwarz <michi.schwarz@gmail.com>
Subject Re: How to improve the usability of nested packages
Date 2012-11-03 10:26 +0100
References <CABdB9Z5sGS4XNw5D7qvq5KciJMHHZrx8WUr4D6ZreqPEVRkCNQ@mail.gmail.com> <5F9CBDF7-2142-4B4E-9EA8-4E1A10777FE5@epy.co.at>
Newsgroups comp.lang.python
Message-ID <mailman.3238.1351934797.27098.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

Hi Stefan

On 2012-W44-5, at 19:23, Stefan H. Holek wrote:

> That said, there are ways to avoid import cycles. One is to very carefully craft your modules so they do not have to import from each other. Another is to not have imports at the module level, but move them into the functions where they are required.

I've also thought about that. I do not like the fact that I then need to educate the other developers about minute details of the import machinery just so they can add code to the library. I'm currently the only developer doing actual work in Python and would like to make the transition as painless as possible.

> Third, large libraries like the Zope Toolkit usually have mechanisms to defer imports to some point after initial loading. You may want explore this direction as well. [2]

Hmm, I like the idea but sadly it doesn't look very IDE-friendly.

Thanks for your tips!
Michael

[1]: http://docs.zope.org/zopetoolkit/codingstyle/python-style.html

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: How to improve the usability of nested packages Michael Schwarz <michi.schwarz@gmail.com> - 2012-11-03 10:26 +0100

csiph-web