473,770 Members | 1,629 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Calling superclass

Hello,
I try to call the superclass of the ConfigParser object:

class CustomizedConfP arser(ConfigPar ser.SafeConfigP arser):
def get(self, section, attribute):
try:
return super(Customize dConfParser, self).get(secti on, attribute)
# [...]
but that gives only

return super(Customize dConfParser, self).get(secti on, attribute)
TypeError: super() argument 1 must be type, not classobj

I don't really understand the error message.

Thanks,

Florian

May 4 '06 #1
1 2098
Florian Lindner wrote:
Hello,
I try to call the superclass of the ConfigParser object:

class CustomizedConfP arser(ConfigPar ser.SafeConfigP arser):
def get(self, section, attribute):
try:
return super(Customize dConfParser, self).get(secti on,
attribute)
# [...]
but that gives only

return super(Customize dConfParser, self).get(secti on, attribute)
TypeError: super() argument 1 must be type, not classobj

I don't really understand the error message.

super works only for newstyle-classes. So additionally extend
CustomizedConfP arser from object.

diez
May 4 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
5160
by: Martin Maney | last post by:
I've been to the cookbook (both forms, since they're sometimes usefully different), but that gave rise to more questions than answers. Heck, let me pull some of them up while I'm at it. Martelli gives the recipie (5.3 on paper) "Calling a Superclass __init__ Method if it Exists" where he seems to say that this: class NewStyleOnly(A, B, C): def __init__(self): super(NewStyleOnly, self).__init__()
6
3716
by: Steven Bethard | last post by:
So when I'm writing a class and I define an __init__ method, I sometimes haven't called object.__init__, e.g.: class C(object): def __init__(self, x): self.x = x instead of class C(object):
2
3036
by: stephane | last post by:
Hi all, What I am trying to achieve is an 'inherits' method similar to Douglas Crockford's (http://www.crockford.com/javascript/inheritance.html) but that can enable access to the superclass' priviledged methods also. Do you know if this is possible ? In the following example, I create an ObjectA (variable a), an ObjectB which inherits ObjectA (variable b) and an ObjectC which inherits ObjectA (variable c1). The 'toString ()' method...
1
2788
by: checcouno | last post by:
I've got MyClassA superclass for MyClassB. In MyClassA there're 2 function f1 and f2. f2 is called from f1. MyClassB specialize MyClassA and, overrides the f2 function. when in MyClassB i call f1 function (base), the f1 function call the base f2 or the overrided f2? I don't need to override f1 function. Thanks
3
1835
by: tac-tics | last post by:
I have a program which has a GUI front-end which that runs a separate thread to handle all the important stuff. However, if there is a problem with the important stuff, I want the GUI to raise a MessageBox alert to indicate this. For exceptions, I can simply use a catch-all except statement like: try: ... except Exception, error:
1
2865
by: shivapadma | last post by:
1..In java we can refer superclass constructor by super()keyword,but Where as in c++ how can we refer to that???. In java the following code is used for referring superclass constructor.. class cal1 { private int a,b,c; public cal1(int i,int j) { a=i;
10
13306
by: Finger.Octopus | last post by:
Hello, I have been trying to call the super constructor from my derived class but its not working as expected. See the code: class HTMLMain: def __init__(self): self.text = "<HTML><BODY>"; print(self.text); def __del__(self): self.text = "</BODY></HTML>"; print(self.text);
0
945
by: Evan Klitzke | last post by:
Hi list, I was reading this article: http://fuhm.net/super-harmful/ and didn't understand the comment about calling super(Foo, self).__init__() when Foo inherits only from object. Can someone on the list elaborate more on why one should do this? -- Evan Klitzke <evan@yelp.com>
3
3529
by: bassman2112 | last post by:
I'm having issues with calling a method defined in a subclass on a superclass object. This program is an exercise using inheritance, with an Employee superclass, Salaried and Hourly classes that extend the superclass and a Temp class that extends the Hourly class. From what I've read, this shouldn't be happening, since the object in employees is a Salaried object. The input is a text file with every line being some piece of information, in the...
0
9595
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10059
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10008
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9873
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8891
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7420
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6682
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5313
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3974
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.