473,387 Members | 1,942 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Re: problem calling parent's __init__ method

On Thu, Aug 7, 2008 at 11:11 AM, Ryan Krauss <ry*******@gmail.comwrote:
I am trying to call a parent's __init__ method from the child's:
This works for me just fine:

class InnerBlock(object):
def __init__(self, codelist, noout=False, **kwargs):
self.codelist = codelist
self.noout = noout

class ArbitraryBlock(InnerBlock):
def __init__(self, codelist, noout=False, **kwargs):
InnerBlock.__init__(self, codelist, noout=noout, **kwargs)

ab = ArbitraryBlock('a, b, c')
That's using python 2.5.2 on Windows XP. What version of python are
you using? On what platform? Can you show us more of your code? Or
a complete self-contained example that shows the problem you are
seeing?

--
Jerry
Aug 7 '08 #1
0 905

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

Similar topics

2
by: user | last post by:
Normally, when I inherit from a class that I have written, I want instances of the new class to call the __init__ of the old (actually, starting from the top of the tree, and moving on down). ...
4
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. ...
3
by: Christian Dieterich | last post by:
Hi, I need to create many instances of a class D that inherits from a class B. Since the constructor of B is expensive I'd like to execute it only if it's really unavoidable. Below is an example...
14
by: Axel Straschil | last post by:
Hello! Im working with new (object) classes and normaly call init of ther motherclass with callin super(...), workes fine. No, I've got a case with multiple inherance and want to ask if this...
2
by: Andrea Gavana | last post by:
Hello NG, this may seem a stupid (or even impossible) question, but my knowlegde of Python is quite limited. I have basically a simple graphical user interface that contains a Panel, another...
5
by: Nick Flandry | last post by:
I'm running into an Invalid Cast Exception on an ASP.NET application that runs fine in my development environment (Win2K server running IIS 5) and a test environment (also Win2K server running IIS...
2
by: dunderhead | last post by:
Hello, I am having a problem with function and class syntax. I have one class (MakePanel1) that creates a button and label. The button-click event of the button is linked to a function...
11
by: manstey | last post by:
Hi, I am having trouble designing my classes. I have two classes. The first one wraps around an old-style class called oref Class CacheClass(object): def __init__(self, obj):
1
by: Ryan Krauss | last post by:
I am trying to call a parent's __init__ method from the child's: class ArbitraryBlock(InnerBlock): def __init__(self, codelist, noout=False, **kwargs): InnerBlock.__init__(self, codelist,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...

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.