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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:13:01+00:00 2026-05-31T07:13:01+00:00

A collection of classes defined as: class A(): @staticmethod def call(): print(‘a’) class C(type):

  • 0

A collection of classes defined as:

class A():
    @staticmethod
    def call():
        print('a')

class C(type):
    def __repr__(self):
        return 'somename'

class B(A):
    __metaclass__ = C

    @staticmethod
    def call():
        print('b')

    def boundcall(self):
        print('bound')

When run, gives this error:

TypeError: Error when calling the metaclass bases
    a new-style class can't have only classic bases

I need the metaclass (I think) to have a known string representation of B in my code. Reason for having that is beside the point but it’ll greatly help with future updates.

So assuming I need C to be the metaclass of B and B will be a subclass of A can someone tell me what is going wrong here and how I might change what I’m doing to remove the error?

  • 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-31T07:13:02+00:00Added an answer on May 31, 2026 at 7:13 am

    The problem is the line

    class A():
    

    It should be:

    class A(object):
    

    That way, you make A a new style class. The empty parens make no sense whatsoever, and still, I keep seeing them on stackoverflow and everywhere. Why, oh why?

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

Sidebar

Related Questions

I've defined a method in a class: public void setCollection(Collection<MyClass>); and in another class
I'm working with an observable collection of a Job class I have defined. I
Raymond Hettinger showed a really cool way to combine collection classes: from collections import
Previously, I used to use MFC collection classes such CArray and CMap . After
I have a system.collections.generic.list(of ListBox) I would like to use the collection classes built-in
I'm studying up on archiving data, and I realize the standard collection classes provide
TEnumerable<T> , the base class for all the Generics.Collections container classes, has a very
I have a class which has two HashSet<String> collections as private members. Other classes
I have a class (ActorClue) that has three attr_accessor defined within it. There are
There are methods like these which require Class literals as argument. Collection<EmpInfo> emps =

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.