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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T06:16:48+00:00 2026-05-31T06:16:48+00:00

I want to know the difference between __init__ and __call__ methods. For example: class

  • 0

I want to know the difference between __init__ and __call__ methods.

For example:

class test:

  def __init__(self):
    self.a = 10

  def __call__(self): 
    b = 20
  • 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-31T06:16:50+00:00Added an answer on May 31, 2026 at 6:16 am

    The first is used to initialise newly created object, and receives arguments used to do that:

    class Foo:
        def __init__(self, a, b, c):
            # ...
    
    x = Foo(1, 2, 3) # __init__
    

    The second implements function call operator.

    class Foo:
        def __call__(self, a, b, c):
            # ...
    
    x = Foo()
    x(1, 2, 3) # __call__
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to know the main difference between .live() vs. .bind() methods in jQuery.
I want to know the difference between self signed and certificate generated by certification
I want to know the difference between int.class and Integer.TYPE in Java?
I want to know the difference Between System.ApplicationException and System.Exception . Can anyone explain
I want to know the difference between : $this->forward(module, action); And $this->redirect(module/action); My first
I just want to know the difference between List<string> lst = new List() and
I am a shell script newbie. I want to know the difference between ${var%pattern}
I am creating ASP.NET textbox controls dynamically. I want to know the difference between
Want to know what is the difference between ipv4 and ipv6 and how does
I want to know what the difference is between alt= and name= Would it

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.