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


Groups > comp.lang.python > #102354

Re: carry **arguments through different scopes/functions

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Terry Reedy <tjreedy@udel.edu>
Newsgroups comp.lang.python
Subject Re: carry **arguments through different scopes/functions
Date Sun, 31 Jan 2016 07:55:41 -0500
Lines 38
Message-ID <mailman.166.1454244955.2338.python-list@python.org> (permalink)
References <3ptWgs1F6Vz5vN2@dovecot03.posteo.de>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 7bit
X-Trace news.uni-berlin.de fN7frhYPeElp+0mPF2XlVA03QeyAGGx8GS0Up6mu2PGw==
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'python3': 0.05; 'sys': 0.05; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'simplified': 0.09; 'python': 0.10; 'python.': 0.11; 'jan': 0.11; 'question.': 0.13; 'def': 0.13; 'variables': 0.15; 'markup.': 0.16; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'reedy': 0.16; 'reproduce': 0.16; 'scopes': 0.16; 'wrote:': 0.16; 'skip:` 10': 0.18; 'variable': 0.18; 'own.': 0.22; 'am,': 0.23; 'import': 0.24; 'header:In-Reply-To:1': 0.24; 'header:User- Agent:1': 0.26; 'example': 0.26; 'header:X-Complaints-To:1': 0.26; 'skip:# 10': 0.27; 'page.': 0.28; 'initial': 0.28; 'subject:/': 0.30; 'that.': 0.30; 'work.': 0.30; 'code': 0.30; 'skip:. 10': 0.32; 'topic': 0.32; 'run': 0.33; 'problem': 0.33; 'text': 0.35; 'but': 0.36; 'list,': 0.36; 'should': 0.36; 'there': 0.36; 'received:71': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'really': 0.37; 'received:org': 0.37; 'things': 0.38; 'mailing': 0.38; 'sure': 0.39; 'does': 0.39; "didn't": 0.39; 'to:addr:python.org': 0.40; 'space': 0.40; 'some': 0.40; 'your': 0.60; 'more': 0.63; 'python-list': 0.66; 'here': 0.66; 'offer': 0.66; 'subject': 0.70; 'subject.': 0.72; 'special': 0.73; 'received:fios.verizon.net': 0.91; 'this!': 0.93
X-Injected-Via-Gmane http://gmane.org/
X-Gmane-NNTP-Posting-Host pool-71-185-227-36.phlapa.fios.verizon.net
User-Agent Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1
In-Reply-To <3ptWgs1F6Vz5vN2@dovecot03.posteo.de>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
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>
Xref csiph.com comp.lang.python:102354

Show key headers only | View raw


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

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

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

csiph-web