[Tutor] Python OO

Mark Lawrence breamoreboy at yahoo.co.uk
Sun Mar 29 03:25:29 CEST 2015


On 29/03/2015 02:16, Juan C. wrote:
> Ok, so, let me try to express what I think is 'right' here according to
> what you said.
>
> My code structure needs to be something like that:
>
> pycinema
> - package: pycinema
> - - __init__.py
> - - api.py
> - - actor.py
> - - movie.py
> - - serie.py
> - __main__.py
>
> And why I use it this way?
>
> 1. You said that I need to separate the API methods and calls from my code,
> so that if I need to move to another API or something like that, all the
> API code and logic will be in one place
>
> 2. I've read in many places that a basic structure, package with all the
> logic and a single __main__.py on the folder root, is good and simple.
>

If your classes are small put them in one source file, which is clearly 
simpler than your proposed structure.  Why over-engineer something if 
there is no need to?

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence



More information about the Tutor mailing list