carry **arguments through different scopes/functions

Terry Reedy tjreedy at udel.edu
Sun Jan 31 07:55:41 EST 2016


On 1/31/2016 7:19 AM, c.buhtz at 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




More information about the Python-list mailing list