Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 500667
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:06:40+00:00 2026-05-13T06:06:40+00:00

Warning, this is a sheer-laziness query! As my project develops, so also do the

  • 0

Warning, this is a sheer-laziness query! As my project develops, so also do the number of functions within a class. I also have a number of classes per .py file. So what I would like to do is re-sort them to that the function names are organised [sorry, UK here, I’ve already compromised hugely with the ‘z’ in Alphabetizing ;-)] alphabetically.

Eg currently:

class myClass():
    stuff
    def __init__():
        do stuff
    def b():
        also do stuff
    def c():
        do other stuff
    def a():
        do even more stuff

..and for ease of lookup, I’d like to rearrange to:

class myClass():
    stuff
    def __init__():
        do stuff
    def a():
        do even more stuff         
    def b():
        also do stuff
    def c():
        do other stuff

purely for cosmetic reasons, as it makes searching for the relevant functions more intuitive. I’d obviously want to keep the init() etc at the top of the class.

Now, I can (but haven’t yet) do this with a python script that reads in the .py the class(es) reside in as a text file, and do a tonne of string manipulation. But I wonder is there a better way to do this? Perhaps there’s a tool I can use somewhere? I’ve had a good hunt, but I can’t really find anything I could use.

I’m using emacs, so perhaps there’s a big 5-minute key combination sequence that will do the magic (eg), but I can’t see anything in python-mode!

Finally, I would like some way to be able to visualise and publicise the class structure/docstrings.

When I say visualise structure, I mean, for example, where myClass.a() calls myOtherClass.g(), that would be a link, so I’d be able to see what calls what, either on a class-by-class basis (ie, what functions/classes does myClass use?) or overall (here are a bunch of files, how do they ‘connect’?)

When I say publicise the class, I guess I mean something like the API documentation you see in eg1,eg2.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T06:06:40+00:00Added an answer on May 13, 2026 at 6:06 am

    I don’t have a solution to your question, but I have a very strong opinion: if the number of methods in your classes becomes so large you have trouble finding them, you should consider reducing the number, perhaps by splitting the class into smaller ones.

    The same principles of cohesion that apply to functions and methods apply to classes as well.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.