Path: csiph.com!weretis.net!feeder4.news.weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: Thomas 'PointedEars' Lahn Newsgroups: comp.lang.python Subject: Re: carry **arguments through different scopes/functions Date: Mon, 01 Feb 2016 00:52:49 +0100 Organization: PointedEars Software (PES) Lines: 54 Message-ID: <1913201.EElG027X7T@PointedEars.de> References: <3ptWgs1F6Vz5vN2@dovecot03.posteo.de> Reply-To: Thomas 'PointedEars' Lahn Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8Bit X-Trace: solani.org 1454284371 31565 eJwNycEBwCAIA8CVsECEcQTD/iPY+54rFnobHObjo3lHwaY1qRQqNiQ6pqQrq/7SszKOX9QXDzn0Eis= (31 Jan 2016 23:52:51 GMT) X-Complaints-To: abuse@news.solani.org NNTP-Posting-Date: Sun, 31 Jan 2016 23:52:51 +0000 (UTC) User-Agent: KNode/4.14.2 X-User-ID: eJwFwYEBwCAIA7CXCpQq5+DQ/09YkiHTt6gU8+WLp1hVuB0VrMTVpkBfwh2NzaDLA1+5jdkgm6fFzTne+gEgYRRn Cancel-Lock: sha1:v8+VlAnCq7GVGJ4w65kqhTaMO9I= X-NNTP-Posting-Host: eJwFwYEBgDAIA7CXRCjtzkGB/09YAk/Ln5HIwGIddaK5w34lHfNPFcgJmhxASWXoebaW5AUNFRCV Xref: csiph.com comp.lang.python:102374 Terry Reedy wrote: > On 1/31/2016 7:19 AM, c.buhtz@posteo.jp wrote: >> I am not sure what the problem is here, so I don't really know how I >> should call the subject for that question. Please offer a better >> subject. >> >> The code below is a extrem simplified example of the original one. But >> it reproduce the problem very nice. Please focus on the variable >> `return_code`. >> >> There is a `list()` of numbers without the number `7` in. The code >> check if the number `7` is in and should tell that it is not in. But it >> does tell me that `7 is in`. ;) > > Python-list is not Stackoverflow. It is a text mailing list, not a web > page. Here, the backticks are not markup; they are just distracting > noise. Don't do this! IBTD. I find it useful to mark up source code in plain text prose even if it is not rendered differently (you cannot know that; there are various user agents, and there could be one that does). I would have used typographical quotation marks (“…”) instead, but I think backticks are a good alternative in US-ASCII, better than straight quotation marks or apostrophes at least since those delimit strings in Python which can lead to ambiguities. (That is probably also why not only Stack Overflow, but *Markdown* uses them this way as Stack Overflow just uses a Markdown flavour: ) >> #!/usr/bin/env python3 >> import sys >> >> def walkOn_ids(ids, handlerFunction, **handlerArgs): >> for one_id in ids: >> handlerFunction(one_id=one_id, **handlerArgs) >> print('after handler-call for id {}\t{}' >> .format(one_id, handlerArgs)) > > Ditto. Here, the initial 4 space indents are not markup. They just > makes it impossible to cut, paste, and run your code without extra work. That much is true, because *in Python* indentation means program structure; so the Python program above is syntactically invalid and should not have been posted this way. However, with a good editor the "extra work" is limited to one application of Shift+Tab, and the extra indentation does not hinder the understanding of the posted source code as much as you imply. -- PointedEars Twitter: @PointedEars2 Please do not cc me. / Bitte keine Kopien per E-Mail.