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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T17:07:41+00:00 2026-05-17T17:07:41+00:00

Given the following example class: class Foo: def aStaticMethod(): return aStaticMethod aVariable = staticmethod(aStaticMethod)

  • 0

Given the following example class:

class Foo:

    def aStaticMethod():
        return "aStaticMethod"

    aVariable = staticmethod(aStaticMethod)
    aTuple = (staticmethod(aStaticMethod),)
    aList = [staticmethod(aStaticMethod)]

print Foo.aVariable()
print Foo.aTuple[0]()
print Foo.aList[0]()

Why would the call to aVariable works properly but with the aTuple and aList it returns the error 'staticmethod' object is not callable?

  • 1 1 Answer
  • 2 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-17T17:07:41+00:00Added an answer on May 17, 2026 at 5:07 pm

    It’s because a static method is a descriptor. When you attach it to a class and call it with the usual syntax, then python calls its __get__ method which returns a callable object. When you deal with it as a bare descriptor, python never calls its __get__ method and you end up attempting to call the descriptor directly which is not callable.

    So if you want to call it, you have to fill in the details for yourself:

    >>> Foo.aTuple[0].__get__(None, Foo)()
    'aStaticMethod'
    

    Here, None is passed to the instance parameter (the instance upon which the descriptor is being accessed) and Foo is passed to the owner parameter (the class upon which this instance of the descriptor resides). This causes it to return an actual callable function:

    >>> Foo.aTuple[0].__get__(None, Foo)
    <function aStaticMethod at 0xb776daac>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given is the following example: class Foo(object): def __init__(self, value=0): self.value=value def __int__(self): return
This is just an example, but given the following model: class Foo(models.model): bar =
Given the following code from a Microsoft example: public class EngineMeasurementCollection : Collection<EngineMeasurement> {
Given the following example, why do I have to explicitly use the statement b->A::DoSomething()
Given the following simple example: List<string> list = new List<string>() { One, Two, Three,
Given a sorted vector with a number of values, as in the following example:
Given the URL (single line): http://test.example.com/dir/subdir/file.html How can I extract the following parts using
Given the following: List<List<Option>> optionLists; what would be a quick way to determine the
Given the following example: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Runtime.Serialization.Formatters.Binary;
Given the following template: template <typename T> class wrapper : public T {}; What

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.