Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #61741
| Path | csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python@mrabarnett.plus.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.010 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'subject:Python': 0.06; 'attribute': 0.07; 'notice,': 0.07; 'http': 0.09; 'line:': 0.09; 'python': 0.11; 'def': 0.12; 'assume': 0.14; 'itself.': 0.14; 'created.': 0.16; 'exist.': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'issue?': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'received:84.93': 0.16; 'received:84.93.230': 0.16; 'retrieving': 0.16; 'wrote:': 0.18; 'variable': 0.18; 'header:User-Agent:1': 0.23; 'instance,': 0.24; 'script': 0.25; 'header:In-Reply-To:1': 0.27; 'code': 0.31; 'aims': 0.31; 'object.': 0.31; 'class': 0.32; 'probably': 0.32; 'skip:_ 10': 0.34; 'received:84': 0.35; 'method': 0.36; 'similar': 0.36; 'url:org': 0.36; 'project': 0.37; 'being': 0.38; 'implement': 0.38; 'follows:': 0.38; 'to:addr:python-list': 0.38; 'issue': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'called': 0.40; 'how': 0.40; 'mentioned': 0.61; "you're": 0.61; 'show': 0.63; 'refer': 0.63; 'charset:windows-1252': 0.65; 'header:Reply- To:1': 0.67; 'reply-to:no real name:2**0': 0.71; 'repeat': 0.74; 'yourself': 0.78; 'actually,': 0.84; 'reply-to:addr:python.org': 0.84; 'gladly': 0.91 |
| X-CM-Score | 0.00 |
| X-CNFS-Analysis | v=2.1 cv=IvYnLtPg c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=0Bzu9jTXAAAA:8 a=baqLi5_GPZIA:10 a=ihvODaAuJD4A:10 a=OUOv7kDek9cA:10 a=N659UExz7-8A:10 a=EBOSESyhAAAA:8 a=8AHkEIZyAAAA:8 a=0kaz3dnlUmMA:10 a=4Iv3f1J1AAAA:8 a=vJTO9xeoJ77UJToIe-kA:9 a=pILNOxqGKmIA:10 |
| X-AUTH | mrabarnett:2500 |
| Date | Thu, 12 Dec 2013 18:59:26 +0000 |
| From | MRAB <python@mrabarnett.plus.com> |
| User-Agent | Mozilla/5.0 (Windows NT 5.1; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: Python Script |
| References | <89929063-4c26-4e97-8f28-c53f1c538d1d@googlegroups.com> |
| In-Reply-To | <89929063-4c26-4e97-8f28-c53f1c538d1d@googlegroups.com> |
| Content-Type | text/plain; charset=windows-1252; format=flowed |
| Content-Transfer-Encoding | 8bit |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| Reply-To | python-list@python.org |
| 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.4012.1386874770.18130.python-list@python.org> (permalink) |
| Lines | 31 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1386874770 news.xs4all.nl 2932 [2001:888:2000:d::a6]:37543 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:61741 |
Show key headers only | View raw
On 12/12/2013 18:05, Amimo Benja wrote:
> I have an issue with a Python script that I will show as follows:
> http://codepad.org/G8Z2ConI
>
> Assume that you have three (well defined) classes: AirBase and VmNet,
> . VmNet has got a method that is called recursively each time an HTTP
> response is received. The variable recordTuple needs to be built
> independently for each instance of VmNet that is created. However,
> the mentioned variable is being overwritten across every instance, so
> if you try to get it from vmnet_instance_y, you would get exactly the
> same than retrieving it from vmnet_instance_x.
>
> • What is the code issue? I need to use this script in a project and
> I don't know how to proceed.
>
> Actually, the script aims to follow the principle don't repeat
> yourself (DRY). As you may notice, VmNet and AirBase does not have
> def __init__(self), so self.recordTupleBase does not probably exist.
> Additionally, many other subclasses, similar to VmNet, can implement
> the recursive method using that recordTupleBase.
>
> * I will gladly appreciate any help thanks....
>
This line:
recordTuple = AirBase.recordTupleBase
makes recordTuple refer to the same object as AirBase.recordTupleBase
and AirBase.recordTupleBase is an attribute of the class AirBase itself.
You're re-using the same object. That's why it's being overwritten.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Python Script Amimo Benja <amimobenja08@gmail.com> - 2013-12-12 10:05 -0800
Re: Python Script Gary Herron <gary.herron@islandtraining.com> - 2013-12-12 10:35 -0800
Re: Python Script Amimo Benja <amimobenja08@gmail.com> - 2013-12-12 22:21 -0800
Re: Python Script Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-12-13 08:38 +0000
Re: Python Script Terry Reedy <tjreedy@udel.edu> - 2013-12-12 13:55 -0500
Re: Python Script Amimo Benja <amimobenja08@gmail.com> - 2013-12-12 22:21 -0800
Re: Python Script MRAB <python@mrabarnett.plus.com> - 2013-12-12 18:59 +0000
Re: Python Script Amimo Benja <amimobenja08@gmail.com> - 2013-12-12 22:26 -0800
csiph-web