Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #56456
| Return-Path | <cameron@cskk.homeip.net> |
|---|---|
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'example:': 0.03; 'class,': 0.07; 'init': 0.07; 'installed.': 0.07; '__init__': 0.09; 'def': 0.12; 'comp': 0.16; 'from:addr:cs': 0.16; 'from:addr:zip.com.au': 0.16; 'from:name:cameron simpson': 0.16; 'letters.': 0.16; 'likewise': 0.16; 'message-id:@cskk.homeip.net': 0.16; 'received:211.29': 0.16; 'received:211.29.132': 0.16; 'received:cskk.homeip.net': 0.16; 'received:homeip.net': 0.16; 'received:optusnet.com.au': 0.16; 'received:syd.optusnet.com.au': 0.16; 'simpson': 0.16; 'subclass': 0.16; 'subclassing': 0.16; 'subject:class': 0.16; 'url:all': 0.16; 'url:courses': 0.16; 'url:py': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'normally': 0.19; 'work,': 0.20; 'header:User-Agent:1': 0.23; 'error': 0.23; 'cheers,': 0.24; 'looks': 0.24; 'source': 0.25; 'class.': 0.26; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'work.': 0.31; 'code': 0.31; 'subject:skip:i 10': 0.31; 'class': 0.32; 'stuff': 0.32; 'another': 0.32; 'bus': 0.33; 'skip:_ 10': 0.34; 'problem': 0.35; 'but': 0.35; 'add': 0.35; 'functions.': 0.36; 'received:com.au': 0.36; 'method': 0.36; 'charset:us-ascii': 0.36; 'received:211': 0.38; 'to:addr:python-list': 0.38; 'ability': 0.39; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'called': 0.40; 'helps': 0.61; 'new': 0.61; 'content-disposition:inline': 0.62; "you've": 0.63; 'email addr:gmail.com': 0.63; 'upper': 0.74; 'url:03': 0.84; 'url:ut': 0.84 |
| Date | Wed, 9 Oct 2013 10:55:28 +1100 |
| From | Cameron Simpson <cs@zip.com.au> |
| To | python-list@python.org |
| Subject | Re: class implementation |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Disposition | inline |
| In-Reply-To | <99e763bd-9757-4d44-ad8d-10fd8a2dc3bd@googlegroups.com> |
| User-Agent | Mutt/1.5.21 (2010-09-15) |
| References | <99e763bd-9757-4d44-ad8d-10fd8a2dc3bd@googlegroups.com> |
| X-Optus-CM-Score | 0 |
| X-Optus-CM-Analysis | v=2.1 cv=bpB1Wiqi c=1 sm=1 tr=0 a=YuQlxtEQCowy2cfE5kc7TA==:117 a=YuQlxtEQCowy2cfE5kc7TA==:17 a=ZtCCktOnAAAA:8 a=PO7r1zJSAAAA:8 a=LcaDllckn3IA:10 a=kj9zAlcOel0A:10 a=vrnE16BAAAAA:8 a=8AHkEIZyAAAA:8 a=kuDvrOF7w3sA:10 a=pGLkceISAAAA:8 a=KvYYkcMtAAAA:8 a=IUAbV2bdh_tXnXSiz6cA:9 a=CjuIK1q_8ugA:10 a=MSl-tDqOz04A:10 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.882.1381278450.18130.python-list@python.org> (permalink) |
| Lines | 31 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1381278450 news.xs4all.nl 15899 [2001:888:2000:d::a6]:35332 |
| X-Complaints-To | abuse@xs4all.nl |
| Path | csiph.com!usenet.pasdenom.info!news.izac.org!ohm.izac.org!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!feed.ac-versailles.fr!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
| Xref | csiph.com comp.lang.python:56456 |
Show key headers only | View raw
On 08Oct2013 01:20, markotaht@gmail.com <markotaht@gmail.com> wrote:
> I cant just subclassing doesent work. It seem the init method of the source class also calls out another class. And the problem is, i can subclass the other class to with the required function but the end result is that it doesent work, since the source class cant accsess the subclass functions.
>
> The source code is pykkar.
>
> https://courses.cs.ut.ee/all/MTAT.03.100/2012_fall/uploads/opik/_downloads/pykkar.py
>
> I want to add it a new ability called left(). I cant manipulate the source class, cause then my comp will be the only one where the program runs.
>
> class pykkar_l(Pykkar):
> def left(self):
> self._world.execute("left")
[...]
You normally need to call the superclasses' __init__ method as well.
Example:
def __init__(self):
Pykkar.__init__(self)
... any of your own init stuff ...
Likewise for your world_l class.
BTW, it is conventional to start class names with an upper case letters. Just
style, but it helps other people when reading your code.
Cheers,
--
Cameron Simpson <cs@zip.com.au>
It looks like you've got Mister Bus Error installed. - tjc
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
class implementation markotaht@gmail.com - 2013-09-30 01:43 -0700
Re: class implementation Peter Otten <__peter__@web.de> - 2013-09-30 11:03 +0200
Re: class implementation markotaht@gmail.com - 2013-09-30 02:10 -0700
Re: class implementation Peter Otten <__peter__@web.de> - 2013-09-30 11:27 +0200
Re: class implementation markotaht@gmail.com - 2013-09-30 05:41 -0700
Re: class implementation Peter Otten <__peter__@web.de> - 2013-09-30 15:02 +0200
Re: class implementation Joel Goldstick <joel.goldstick@gmail.com> - 2013-09-30 09:21 -0400
Re: class implementation Piet van Oostrum <piet@vanoostrum.org> - 2013-09-30 13:32 -0400
Re: class implementation Dave Angel <davea@davea.name> - 2013-09-30 19:34 +0000
Re: class implementation 88888 Dihedral <dihedral88888@gmail.com> - 2013-10-01 00:01 -0700
Re: class implementation Ned Batchelder <ned@nedbatchelder.com> - 2013-09-30 17:28 -0400
Re: class implementation Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-09-30 23:45 +0000
Re: class implementation Ethan Furman <ethan@stoneleaf.us> - 2013-09-30 17:31 -0700
Re: class implementation random832@fastmail.us - 2013-09-30 17:49 -0400
Python variables? [was Re: class implementation] Ethan Furman <ethan@stoneleaf.us> - 2013-09-30 15:02 -0700
Re: Python variables? Ben Finney <ben+python@benfinney.id.au> - 2013-10-01 08:37 +1000
Re: Python variables? [was Re: class implementation] Ned Batchelder <ned@nedbatchelder.com> - 2013-09-30 19:45 -0400
Re: Python variables? [was Re: class implementation] "Rhodri James" <rhodri@wildebst.demon.co.uk> - 2013-10-01 01:29 +0100
Re: Python variables? Ned Batchelder <ned@nedbatchelder.com> - 2013-09-30 19:47 -0400
Re: Python variables? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-10-01 01:03 +0000
Re: Python variables? Ned Batchelder <ned@nedbatchelder.com> - 2013-09-30 21:28 -0400
Re: class implementation Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-10-01 00:19 +0000
Re: class implementation markotaht@gmail.com - 2013-10-06 06:15 -0700
Re: class implementation Terry Reedy <tjreedy@udel.edu> - 2013-10-06 15:52 -0400
Re: class implementation Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-10-07 01:24 +0000
Re: class implementation markotaht@gmail.com - 2013-10-08 01:20 -0700
Re: class implementation Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-10-08 09:41 +0100
Re: class implementation Dave Angel <davea@davea.name> - 2013-10-08 10:31 +0000
Re: class implementation Cameron Simpson <cs@zip.com.au> - 2013-10-09 10:55 +1100
Re: class implementation markotaht@gmail.com - 2013-10-10 11:34 -0700
Re: class implementation Cameron Simpson <cs@zip.com.au> - 2013-10-11 09:07 +1100
Re: class implementation Piet van Oostrum <piet@vanoostrum.org> - 2013-10-10 19:29 -0400
Re: class implementation Ben Finney <ben+python@benfinney.id.au> - 2013-10-11 10:51 +1100
Re: class implementation markotaht@gmail.com - 2013-10-08 07:05 -0700
Re: class implementation "Rhodri James" <rhodri@wildebst.demon.co.uk> - 2013-10-09 00:41 +0100
csiph-web