473,749 Members | 2,384 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

"Learning Python" 2nd ed. p479 error?

Hello all.

On page 479, the 2nd edition of the "Learning Python" book, this code
appears

class Derived(Base):
def __init__(self, arg, *args, **kw):
self.__init__(s elf, *args, **kw)

Surely self.__init__ should be

Base.__init__

Everything else in the book has been crystal clear. Up to page 479!
It doesn't appear in the errata. What am I misunderstandin g?
Regards,

Abraham

May 26 '06 #1
4 1516
Ab************* *******@yahoo.c om wrote:
On page 479, the 2nd edition of the "Learning Python" book, this code
appears

class Derived(Base):
def __init__(self, arg, *args, **kw):
self.__init__(s elf, *args, **kw)

Surely self.__init__ should be

Base.__init__
I don't have a copy within reach, but from what you say, it sure looks
like a typo.
It doesn't appear in the errata. What am I misunderstandin g?


nothing, except perhaps what's the best place to report errors in
O'Reilly books (I'm quite sure they don't read this newsgroup ;-)

there's a "view/submit errata" link on this page:

http://www.oreilly.com/catalog/lpython2/

</F>

May 26 '06 #2
Ab************* *******@yahoo.c om wrote:
Hello all.

On page 479, the 2nd edition of the "Learning Python" book, this code
appears

class Derived(Base):
def __init__(self, arg, *args, **kw):
self.__init__(s elf, *args, **kw)

Surely self.__init__ should be

Base.__init__

Everything else in the book has been crystal clear. Up to page 479!
It doesn't appear in the errata. What am I misunderstandin g?


Seems to be a typo:

Python 2.4.2 (#1, Jan 23 2006, 21:24:54)
[GCC 3.3.4] on linux2
Type "help", "copyright" , "credits" or "license" for more
information.
class A(object): .... def __init__ (self):
.... print 'Constructing A'
.... class B(A): .... def __init__ (self):
.... self.__init__ (self)
.... B() Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "<stdin>", line 3, in __init__
TypeError: __init__() takes exactly 1 argument (2 given) class C(A): .... def __init__ (self):
.... A.__init__ (self)
.... C()

Constructing A
<__main__.C object at 0x402cf5ac>


Mel.
May 26 '06 #3
Looks like an error. I didn't see it the errata:

http://www.oreilly.com/catalog/lpython2/errata/

May 26 '06 #4
Thanks for your help, guys. I'm convinced it is a bug, not a
misunderstandin g. I submitted it to the errata page at O'Reilly.
Regards,

Abraham

May 27 '06 #5

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

Similar topics

5
9110
by: Giles Brown | last post by:
I'm feeling quite dumb this morning. I'm trying to build a COM server DLL using py2exe and it ain't working. Here's what ain't working... setup_dll.py based on py2exe sample: """from distutils.core import setup import py2exe
0
2029
by: vincent wehren | last post by:
Hi, Trying to grasp Py_NewInterpreter()in a simple app embedding Python, I was wondering why the following gives me an error: int main() { PyThreadState *tstate; Py_Initialize();
0
2213
by: python-help-bounces | last post by:
Your message for python-help@python.org, the Python programming language assistance line, has been received and is being delivered. This automated response is sent to those of you new to python-help, to point out a few resources that can help with answering your own questions, or improve the chances of getting a useful answer from the helpers. The most comprehensive overview of python.org help resources is at ...
2
5114
by: David Dürrenmatt | last post by:
Hi. If I try to use decompyle (decompyle-2.3) for pyc-files < version 2.0, I get an error with marshal_20 (ImportError: dynamic module does not define init function (initmarshal_20) ). marshal_20 was compiled to a so-file using gcc. Does anybody know where this error could come from and how to solve it? Thanks,
7
7705
by: jeffbernstein | last post by:
Greetings. I'm reading "How to think like a computer scientist: Learning with Python" and there's a question regarding string operations. The question is, "Can you think of a property that addition and multiplication have that string concatenation and repetition do not?" I thought it was the commutative property but "<string>"*3 is equivalent to 3*"<string>". Any ideas?
30
2913
by: bblais | last post by:
Hello, Let me start by saying that I am coming from a background using Matlab (or Octave), and C++. I am going to outline the basic nuts-and-bolts of how I work in these languages, and ask for some help to find out how the same thing is done in Python. I am not sure what the standard is. In C++, I open up an editor in one window, a Unix shell in another. I write the code in the editor, then switch to the shell window for compile...
2
3204
by: André | last post by:
Short description: Using a wxPython based app, I would like to take a python script in an editor window, invoke the python interpreter and use another window as stdin/stdout/stderr. Based on what I've read so far, I've figured that I need to do something like: f_in, f_out = popen4("python -u script.py") where I have extracted the text from the editor and put it in "script.py". (However, see below).
2
1469
by: Blair LeGent | last post by:
Following the directions in "Python in a Nutshell" (an excellent book), I entered the C code for "helloworld.c", saved it as a file, and entered this script and saved it as setup.py: from distutils.core import setup, Extension setup(name='helloworld', ext_modules= )]) Then, following directions, I type "python setup.py install" from a C:\> prompt. I get these messages:
7
4359
by: Richard Phillips | last post by:
Hello, Does anyone else out there have a copy of this? I'm working through my copy and have discovered that it has no chapter 11... Pages 341-388 are just not there! Anyone else able to check a copy out for me, to see if it's a common problem? I've emailed O'Reilly, no reply yet. Cheers,
0
8996
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
8832
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9388
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
9333
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
9254
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...
1
6800
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
6078
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
4879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3319
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.