473,573 Members | 3,117 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 1510
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
9092
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
2013
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
2192
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...
2
5099
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
7670
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...
30
2886
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...
2
3196
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...
2
1464
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...
7
4342
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
7778
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...
0
8017
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7777
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...
0
8063
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...
1
5585
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...
0
5290
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...
0
3731
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2203
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
1
1300
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.