Best Practices for Internal Package Structure

Ethan Furman ethan at stoneleaf.us
Tue Apr 5 16:02:31 EDT 2016


On 04/05/2016 12:09 PM, Sven R. Kunze wrote:
> On 05.04.2016 20:40, Ethan Furman wrote:
>> Steven D'Aprano wrote:

>>> Your package is currently under 500 lines. As it stands now, you could
>>> easily flatten it to a single module:
>>>>>> bidict.py
>>>> Yup... well, actually you could just stick it in __init__.py.
>> Interesting. We did (and I started it) a similar thing for some packages
> which then grew unbearably in a single year.
>> Now, everybody in team agrees with: 'who idiot put this stuff in
> __ini__.py?' It was me who started it so I take it with a smile. But
> it's definitely a wart.
>> So, we have a new guideline since then: "empty __init__.py" if possible
> of course; you sometimes need to collect/do magic imports but that's a
> separate matter.

For application level stuff, sure. I mostly write various utilities 
where one __init__.py and one test.py fill the bill. I see `bidict` as 
a utility-class item, though.
--
~Ethan~


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /