By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,715 Members | 748 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,715 IT Pros & Developers. It's quick & easy.

Guide to organizing modules?

P: n/a
I've been finding at work that I've written a set of functions several
times, sometimes with more or less features or bugs, so I've decided
to take my small, useful functions and put them in some common place.
I've made a module for this, but it is quickly becoming a jumbled mess
of unrelated functions. Also the one class that I've written with
inheritance takes up fully 1/3 of the documentation (compared to 20
other functions). Since this is a large class I'm thinking of moving
it to a separate module, but on the other hand it seems silly to have
a whole module for just a single class. Also I'm worried that if I
wait till later to organize it better, I'll have a lot of code where
I'll need to fix-up the naming conventions.

In summary: are there any good (or official) guidelines for how to
organize and separate python functions and classes into modules?
Jun 27 '08 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Jun 6, 10:32 am, bukzor <workithar...@gmail.comwrote:
In summary: are there any good (or official) guidelines for how to
organize and separate python functions and classes into modules?
Hey bukzor,

Are you familiar with the concept of packages in Python?

http://docs.python.org/tut/node8.htm...00000000000000

That should allow you to keep all of your scriptlets as separate files
while still having the advantage of keeping them in a single namespace
for importing.

(But if you know this already, don't mind me....)

Jun 27 '08 #2

P: n/a
On Jun 5, 5:58 pm, alex23 <wuwe...@gmail.comwrote:
On Jun 6, 10:32 am, bukzor <workithar...@gmail.comwrote:
In summary: are there any good (or official) guidelines for how to
organize and separate python functions and classes into modules?

Hey bukzor,

Are you familiar with the concept of packages in Python?

http://docs.python.org/tut/node8.htm...00000000000000

That should allow you to keep all of your scriptlets as separate files
while still having the advantage of keeping them in a single namespace
for importing.

(But if you know this already, don't mind me....)
Yes, in the above post I meant to say package where I said module.
Right now all my functions are in the __init__.py script, and I would
consider separating them out into sub-packages, if it had any rhyme or
reason, but right now that escapes me. That's mostly what I'm trying
to ask for.

Thanks,
--Buck
Jun 27 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.