Ecere SDK/eC Forums • View topic - Doing things "Pythonically"




Ecere SDK/eC Forums

Ecere Developers Community

Doing things "Pythonically"

Forum for discussing the improvement of interoperability with other object-oriented programming language: C++, .NET/CLI, Objective-C, Python ...

Doing things "Pythonically"

Postby ubuntourist » Tue Aug 29, 2017 9:45 am

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.
ubuntourist
 
Posts: 1
Joined: Mon Aug 28, 2017 8:05 am

Re: Doing things "Pythonically"

Postby jerome » Tue Aug 29, 2017 2:04 pm

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
jerome
Site Admin
 
Posts: 614
Joined: Sat Jan 16, 2010 11:16 pm


Return to Language Interoperability

Who is online

Users browsing this forum: No registered users and 1 guest

cron