473,411 Members | 2,184 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

Guide to organizing modules?

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
2 1253
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Jamie | last post by:
Hi, Thanks for the excellent answer to my last question! One more: Does anyone have a method they follow for organizing stylesheets themselves? They seem like they can get bloated and hard to...
10
by: Rada Chirkova | last post by:
Hi, at NC State University, my students and I are working on a project called "self-organizing databases," please see description below. I would like to use an open-source database system for...
3
by: G Patel | last post by:
Hello, If a program has two source files: main.c secondaryfunctions.c and I have a header file: secondaryfunctions.h (with prototypes for the function) The only function in main.c is main()...
2
by: Eric S. Johansson | last post by:
I have a bunch of small modules that I use within my application. Most of these modules are single file modules. Currently, I have them set up as stand-alone modules but because it's a royal pain...
1
by: Ushach | last post by:
hi, I want to know about Self Organizing maps.T ounderstand the concept ,I need a small example which explains how clustering is done through self organizing maps?If any body implemented it plz...
8
by: Darren Dale | last post by:
I was just searching for some guidance on how to name packages and modules, and discovered some inconsistencies on the www.python.org. http://www.python.org/doc/essays/styleguide.html says "Module...
12
by: xkenneth | last post by:
All, I apologize if this is a commonly asked question, but I didn't find anything that answered my question while searching. So what I have right now is a few packages that contain some...
5
by: ivarnelispam | last post by:
Hello all, I'm starting work on what is going to become a fairly substantial Python project, and I'm trying to find the best way to organize everything. The project will consist of: - A few...
1
by: eliben | last post by:
Hello, At the moment, I place all the code of my project in a src/ directory, and all the tests in a sibling tests/ directory, so for instance a sample project can look like this: doc/ ......
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.