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 3805832
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T14:44:25+00:00 2026-05-19T14:44:25+00:00

in python there is way to declare def ‘s without putting it in class.

  • 0

in python there is way to declare def‘s without putting it in class. So, if i just need to store many def‘s in separated class, i should simple do this:

def first_method():
    pass

def second_method():
    pass

and not use @classmethod or @staticmethod?:

class methods():

    @classmethod
    def first_method(cls):
        pass

    @staticmethod
    def second_method():
        pass

if first way is right, how should i mark private and public method?

  • 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-19T14:44:25+00:00Added an answer on May 19, 2026 at 2:44 pm

    Yes. Just keep functions that are not instance methods out of your classes.

    You’re thinking like you would in Java. Python isn’t Java. Python has no true way to have public and private methods — you can change the names to indicate that you’d like some form of privacy (_ or __ at the beginning of the name), but it’s not enforceable.

    I’ve found that in all the time I’ve programmed in Python, I never wished for access modifiers.

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

Sidebar

Related Questions

Is there a way I can make class decorators work on Google App Engine
Is there any way to create a multidinensional array that contains arrays of different
I really hate when I want to store/fetch something from the database, I have
I have python code below that will loop through a table and print out
I'm returning to Java after a year spent working with Python, so I'm trying
I like having log data in a last-first form (the same way most blogs
I use pyscripter for coding, it supports auto-completion. So, when I say: a =
Header files with declarations like this: void FooBar(System::Network::Win32::Sockets::Handle handle, System::Network::Win32::Sockets::Error& error /*, more fully-qualified
My project requires Java 1.6 for compilation and running. Now I have a requirement

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.