Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #38929
| Date | 2013-02-15 17:59 +0100 |
|---|---|
| From | Bob Brusa <bob.brusa@gmail.com> |
| Subject | inheritance and how to use it |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1819.1360947575.2939.python-list@python.org> (permalink) |
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-15">
</head>
<body text="#330099" bgcolor="#FFFFFF">
Hi,<br>
I use a module downloaded from the net. Now I want to build my own
class, based on the class SerialInstrument offered in this module -
and in my class I would like to initialize a few things, using e. g.
the method clear() offered by SerialInstrument. Hence I type:<br>
<br>
class myClass(SerialInstrument)<br>
self.clear(self)<br>
def f1(self, str1, str2)<br>
...do something etc.<br>
<br>
I then get the message "self not know" from the statement
self.clear(self). I have tried many other notations - none worked.
What works is however the following code - specifying myClass
without the self.clear(self) in it:<br>
<br>
x = myClass("argument")<br>
x.clear()<br>
<br>
How can I integrate this call into the definition of myClass? Thanks
for advice.<br>
Bob<br>
</body>
</html>
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
inheritance and how to use it Bob Brusa <bob.brusa@gmail.com> - 2013-02-15 17:59 +0100
Re: inheritance and how to use it Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2013-02-15 18:06 +0100
Re: inheritance and how to use it Bob Brusa <bob.brusa@gmail.com> - 2013-02-15 18:50 +0100
Re: inheritance and how to use it Dave Angel <davea@davea.name> - 2013-02-15 13:06 -0500
Re: inheritance and how to use it Bob Brusa <bob.brusa@gmail.com> - 2013-02-15 20:40 +0100
Re: inheritance and how to use it Tony the Tiger <tony@tiger.invalid> - 2013-02-19 16:04 -0600
csiph-web