organizing your scripts, with plenty of re-use
Stef Mientki
stef.mientki at gmail.com
Sun Oct 4 11:48:08 EDT 2009
Steven D'Aprano wrote:
> On Sat, 03 Oct 2009 10:24:13 +0200, Stef Mientki wrote:
>
>
>> I still don't use (because I don't fully understand them) packages, but
>> by trial and error I found a reasonable good working solution, with the
>> following specifications
>>
>
> I find that fascinating. You haven't used packages because you don't
> understand them, but you've used another technique that you *also* don't
> understand well enough to generate a solution, and had to rely on trial
> and error.
>
> Packages are quite well documented. Since the alternative was trial-and-
> error on something you also don't fully understand, why did you avoid
> packages?
>
>
>
>
I want to have the possibility to import any file from any other file:
<quote from your other answer>
parrot/
+-- __init__.py
+-- feeding/
+-- __init__.py
+-- eating.py
+-- drinking.py
+-- fighting.py
+-- flying.py
+-- sleeping.py
+-- talking.py
import parrot # loads parrot/__init__.py
import parrot.talking # loads parrot/talking.py
from parrot import sleeping
import parrot.feeding
from parrot.feeding.eating import eat_cracker
</quote>
Instead of the above:
from sleeping import sleeping_in_a_bed
from eating import eat_cracker
anything wrong with that (knowing I've no redundancy) ?
cheers,
Stef
More information about the Python-list
mailing list