Page 1 of 1

Doing things "Pythonically"

PostPosted: Tue Aug 29, 2017 9:45 am
by ubuntourist
In addition to the afore-mentioned PEP-8, instead of a monolithic pyecere.py, it would "feel more Pythonic" to have a directory named either Ecere or PyEcere, and within it, an empty __init__.py -- well, not necessarily empty, but quite often they are -- and then each class broken out into its own filename, e.g.
Code: Select all
class Resource
would be in Resource.py.

Users of the package would then code as either:

Code: Select all
from Ecere import *
x = Resource.Resource()

or

Code: Select all
from Ecere.Resource import *
x = Resource()

I know the first example feels a bit redundant, and I'm no expert. Take a look at packages already installed on your system to see what the common idiom is. But generally, it's lots of smaller files possibly nested in subdirectories, rather than one honkin' huge monolith with every class in it.

Re: Doing things "Pythonically"

PostPosted: Tue Aug 29, 2017 2:04 pm
by jerome
Thanks for that feedback!

It would make sense indeed to have smaller files, pyecere.py is ridiculously big.

In fact, even the eC Ecere library we are planning to split into a number of separate libraries.

However, our immediate goal is to get things building and the bindings working as they should and redj already has a lot on his plate with this! (and he is also working on C++, Java and C# bindings as well).

We can definitely come back to take a look at doing things in a more Pythonic way later. Maybe not down to one file per class but certainly I agree more smaller files would be a good idea.

We were also investigating ways in which we could make things smaller in how args are processed.

Best regards,

-Jerome