Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #99752
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Terry Reedy <tjreedy@udel.edu> |
| Newsgroups | comp.lang.python |
| Subject | Re: Question about code writing '% i, callback' |
| Date | Mon, 30 Nov 2015 12:36:56 -0500 |
| Lines | 18 |
| Message-ID | <mailman.45.1448905059.14615.python-list@python.org> (permalink) |
| References | <25af8ac3-5fc7-44bd-a73f-7a870b69515a@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Trace | news.uni-berlin.de jFvzuPAyrMGqKjXyOKP8Eg3ALQUIM21MvjmOOztvidaw== |
| 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.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'subject:Question': 0.05; 'subject:code': 0.07; 'callback': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'jan': 0.11; 'def': 0.13; 'buggy': 0.16; 'callback)': 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; 'subject:writing': 0.16; 'wrote:': 0.16; '%s"': 0.22; 'am,': 0.23; 'code.': 0.23; 'header:In-Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; 'example': 0.26; 'header:X -Complaints-To:1': 0.26; 'followed': 0.27; 'print': 0.30; 'code': 0.30; 'common': 0.33; 'url:org': 0.36; 'received:71': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'version': 0.38; 'to:addr:python.org': 0.40; 'skip:u 10': 0.61; 'url:htm': 0.75; '11:44': 0.84; 'received:fios.verizon.net': 0.91 |
| 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.4.0 |
| In-Reply-To | <25af8ac3-5fc7-44bd-a73f-7a870b69515a@googlegroups.com> |
| 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:99752 |
Show key headers only | View raw
On 11/30/2015 11:44 AM, fl wrote:
> I come across the following code snippet.
> for i in range(10):
> def callback():
> print "clicked button", i
> UI.Button("button %s" % i, callback)
> http://effbot.org/zone/default-values.htm
Note that the above is an intentional example of common buggy code. It
is followed by a version that works, with 'i=i' added to the callback
header.
--
Terry Jan Reedy
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Question about code writing '% i, callback' fl <rxjwg98@gmail.com> - 2015-11-30 08:44 -0800
Re: Question about code writing '% i, callback' Zachary Ware <zachary.ware+pylist@gmail.com> - 2015-11-30 10:53 -0600
Re: Question about code writing '% i, callback' Zachary Ware <zachary.ware+pylist@gmail.com> - 2015-11-30 10:54 -0600
Re: Question about code writing '% i, callback' Ian Kelly <ian.g.kelly@gmail.com> - 2015-11-30 11:01 -0600
Re: Question about code writing '% i, callback' fl <rxjwg98@gmail.com> - 2015-11-30 10:55 -0800
Re: Question about code writing '% i, callback' Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-11-30 20:44 -0500
Re: Question about code writing '% i, callback' Ian Kelly <ian.g.kelly@gmail.com> - 2015-12-01 09:53 -0600
Re: Question about code writing '% i, callback' fl <rxjwg98@gmail.com> - 2015-11-30 09:36 -0800
Re: Question about code writing '% i, callback' Ian Kelly <ian.g.kelly@gmail.com> - 2015-11-30 11:24 -0700
Re: Question about code writing '% i, callback' Terry Reedy <tjreedy@udel.edu> - 2015-11-30 12:36 -0500
Re: Question about code writing '% i, callback' fl <rxjwg98@gmail.com> - 2015-11-30 09:50 -0800
csiph-web