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

  • Home
  • SEARCH
  • 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 9255453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:43:16+00:00 2026-06-18T11:43:16+00:00

i have a class that will make multiple instances. whats the difference between making

  • 0

i have a class that will make multiple instances. whats the difference between making a method and calling that method versus making a class and a function then using that function on the class? Does the first cost more memory because the method is “instantiated”?

Example:

class myclass:
    def __init__(self):
        self.a=0

    def mymethod:
        print self.a

inst1=myclass()
myclass.mymethod

versus:

class myclass:
    def __init__(self):
        self.a=0

def myfunction(instance):
    print instance.a

inst1=myclass()
myfunction(inst1)
  • 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-06-18T11:43:17+00:00Added an answer on June 18, 2026 at 11:43 am

    Methods are really just functions that always receive a class instance as a first parameter (and happen to be declared within the scope of a class). The code of a method is shared across all instances, so you won’t be “instantiating” a method every time you make a class instance.

    So, they are really equivalent; you use whatever is the clearest expression of your intent (readability counts!). If you are writing a function that always takes an instance of a specific class as an argument, it is probably clearest expressed as a method. If the function can operate on many different kinds of classes, it may be clearest as a function.

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

Sidebar

Related Questions

I'm creating a class that will have one public method, which returns a value
I have written a class that will handle internal logging in my application. Now
I have created a class that will manage connection and commands, I named it
I have written an apex class that will create a PDF quote and attach
If you have data for a class that will be modified and needs to
I made a music class that will play a song. I have made onResume
So let's assume I have a class named ABC that will have a list
I have a buffer in class 'bufferClass' that will generate a signal to tell
I have a helper class that I want to display a UIAlertView then will
I have a timeseries class that, over the course of a day will hold

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.