Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #37223
| Path | csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!nntp-feed.chiark.greenend.org.uk!ewrotcd!news.nosignal.org!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.008 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'result,': 0.05; 'assign': 0.07; 'returned.': 0.07; 'garbage': 0.09; 'though...': 0.09; 'steve': 0.13; 'created.': 0.16; 'discarded': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'returned,': 0.16; 'subject:handling': 0.16; 'wrote:': 0.17; 'basis,': 0.22; 'ctypes': 0.22; 'please?': 0.22; 'references': 0.23; 'statement': 0.23; 'this:': 0.23; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'mike': 0.27; 'object,': 0.27; 'correct': 0.28; 'function': 0.30; 'could': 0.32; 'clarify': 0.33; 'to:addr:python-list': 0.33; 'thanks': 0.34; 'whatever': 0.35; 'so,': 0.35; 'doing': 0.35; 'expected': 0.35; 'there': 0.35; 'created': 0.36; 'but': 0.36; 'subject:: ': 0.38; 'object': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'called': 0.39; 'received:192.168': 0.40; 'your': 0.60; "you've": 0.61; 'therefore': 0.65; 'header:Reply-To:1': 0.68; 'reply-to:no real name:2**0': 0.72; 'mike,': 0.84; 'reply-to:addr:python.org': 0.84; 'simmons': 0.84 |
| X-CM-Score | 0.00 |
| X-CNFS-Analysis | v=2.0 cv=XeZXOvF5 c=1 sm=1 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=Tv4_tr9OjFAA:10 a=mMF3AezpnvEA:10 a=ihvODaAuJD4A:10 a=OUOv7kDek9cA:10 a=8nJEP1OIZ-IA:10 a=EBOSESyhAAAA:8 a=8AHkEIZyAAAA:8 a=l6wdPnSSw00A:10 a=V3OdLBs0ueeIRYb5TG0A:9 a=wPNLvfGTeEIA:10 a=0nF1XD0wxitMEM03M9B4ZQ==:117 |
| X-AUTH | mrabarnett:2500 |
| Date | Mon, 21 Jan 2013 20:21:22 +0000 |
| From | MRAB <python@mrabarnett.plus.com> |
| User-Agent | Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130107 Thunderbird/17.0.2 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: handling return codes from CTYPES |
| References | <50FD1C6F.6030801@gmail.com> <50FD5B47.8030807@vrplumber.com> <50FD7255.3010206@gmail.com> |
| In-Reply-To | <50FD7255.3010206@gmail.com> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| 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 | <http://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 | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.762.1358799685.2939.python-list@python.org> (permalink) |
| Lines | 39 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1358799685 news.xs4all.nl 6938 [2001:888:2000:d::a6]:58101 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:37223 |
Show key headers only | View raw
On 2013-01-21 16:52, Steve Simmons wrote: > Mike, > > Thanks for your response - I was puzzled by one part of it though... > > On 21/01/2013 15:14, Mike C. Fletcher wrote: >> That's because you've just discarded the object you created > > I (mis?)understood from the ctypes documentation that '>>> initResult = > c_short(0)' would result in the creation of a ctypes 'short' called > initResult and that this object would be mutable. On that basis, I > expected the following statement '>>> initResult = initScanLib( ... )' > would assign the result of the call to initResult. > > So, I can understand that I am not using the correct approach but I > don't understand how I discarded the object I created. Can you clarify > please? > This: initResult = initScanLib( ... ) will make initResult refer to whatever initScanLib(...) returned, just as this: initResult = c_short(0) will make initResult refer to whatever c_short(0) returned. What you were doing was this: 1. You created a c_short object and bound initResult to it. 2. You called a function and bound initResult to its result, unbinding the c_short object in the process. 3. There were no other references to the c_short object, therefore it could be discarded by the garbage collector.
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: handling return codes from CTYPES MRAB <python@mrabarnett.plus.com> - 2013-01-21 20:21 +0000
csiph-web