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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T13:34:00+00:00 2026-06-01T13:34:00+00:00

I was working with inheritance in WTForms . I had next class: class MyForm(WTForms):

  • 0

I was working with inheritance in WTForms.
I had next class:

class MyForm(WTForms):
    ...
    def process(self, formdata=formdata, obj=None):
        super(self.__class__, self).process(formdata=formdata, obj=obj)

And I had error (not always, but in some cases with similar forms – it is even more strange):

Maximum recursion depth have been exceeded

But when I’ve changed self.__class__ → MyForm everything was OK!

I don’t get it… As I know they must be synonyms. What’s wrong?

  • 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-01T13:34:02+00:00Added an answer on June 1, 2026 at 1:34 pm

    They are not synonyms. self may be any object of a class that inherits from MyForm. Python does not silently create a new superclass object for calling inherited methods, it just passes the same object (doing so would break polymorphism and serve no use). And the type()/.__class__ is obviously the class the object is really an instance of, not some superclass of that (you don’t expect MyShinyThing().__class__ to yield object, right?). It would be really astonishing, non-idiomatic and useless if __class__ changed depending on where it is accessed from. It’s just polymorphism.

    And as the first argument to super is an indicator where in the MRO the search for a supermethod should continue (informally: where you currently are), passing self.__class__ always starts back at the (immediate) superclass of whatever class self is an instance of. Assuming proper super calls elsewhere in the class hierarchy, this ultimately gets you back to MyForm.process, and we’ve got our infinite loop.

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

Sidebar

Related Questions

I'm working on modifying part of an existing Rails app to use the Class-Table-Inheritance
I have a simple code fragment in JS working with prototype inheritance. function object(o)
I'm working with mechanize and having problems with inheritance when testing in a rails
I am working on a homework assignment looking at inheritance in java. I am
Am working with django 1.3 and doing some template inheritance. My /static/ settings path
I'm working on a project that involves a lot of interfacing and inheritance, which
So I've been working with inheritance and I've run into a problem. I'm very
I'm doing some per table inheritance and all is working great- but I'm noticing
I'm wondering whether or class data members from multiple levels of inheritance are allocated
I was working the last 5 years with the assumption that virtual inheritance breaks

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.