Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #102354 > unrolled thread

Re: carry **arguments through different scopes/functions

Started byTerry Reedy <tjreedy@udel.edu>
First post2016-01-31 07:55 -0500
Last post2016-02-01 00:52 +0100
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: carry **arguments through different scopes/functions Terry Reedy <tjreedy@udel.edu> - 2016-01-31 07:55 -0500
    Re: carry **arguments through different scopes/functions Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-02-01 00:52 +0100

#102354 — Re: carry **arguments through different scopes/functions

FromTerry Reedy <tjreedy@udel.edu>
Date2016-01-31 07:55 -0500
SubjectRe: carry **arguments through different scopes/functions
Message-ID<mailman.166.1454244955.2338.python-list@python.org>
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!

> I think I didn't know some special things about scopes of variables in
> Python. This might be a very good problem to learn more about that. But
> I don't know on which Python topic I should focus here to find a
> solution for my own.
>
>      #!/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.


-- 
Terry Jan Reedy

[toc] | [next] | [standalone]


#102374

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2016-02-01 00:52 +0100
Message-ID<1913201.EElG027X7T@PointedEars.de>
In reply to#102354
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: 
<http://stackoverflow.com/help/formatting>)
 
>>      #!/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.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web