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


Groups > comp.lang.python > #99804

Re: Question about code writing '% i, callback'

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Ian Kelly <ian.g.kelly@gmail.com>
Newsgroups comp.lang.python
Subject Re: Question about code writing '% i, callback'
Date Tue, 1 Dec 2015 09:53:40 -0600
Lines 26
Message-ID <mailman.77.1448985262.14615.python-list@python.org> (permalink)
References <25af8ac3-5fc7-44bd-a73f-7a870b69515a@googlegroups.com> <mailman.41.1448902962.14615.python-list@python.org> <53ef7ef4-cfec-4c91-a45c-5b847dde8fad@googlegroups.com> <pnup5bhvr6odj3suklt4sgnph6mdr2qh85@4ax.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
X-Trace news.uni-berlin.de 8glkHV+vHxej5V+ZzIAXjAQhyS67kDzqxUrRYEn+yIfg==
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.027
X-Spam-Evidence '*H*': 0.95; '*S*': 0.00; 'subject:Question': 0.05; 'subject:code': 0.07; 'callback)': 0.16; 'ian.': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:writing': 0.16; 'wrote:': 0.16; 'module,': 0.18; '2015': 0.20; '%s"': 0.22; 'fit': 0.23; 'header:In-Reply-To:1': 0.24; 'mon,': 0.24; 'example': 0.26; 'message-id:@mail.gmail.com': 0.27; 'correct': 0.28; 'equivalent.': 0.29; 'class.': 0.30; 'another': 0.32; 'class': 0.33; 'case,': 0.34; 'received:google.com': 0.35; 'instance': 0.35; 'nov': 0.35; 'item': 0.35; 'there': 0.36; 'created': 0.36; 'received:209.85': 0.36; 'to:addr:python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'method': 0.37; 'received:209.85.213': 0.37; 'itself': 0.38; 'received:209': 0.38; 'whatever': 0.39; 'does': 0.39; 'to:addr:python.org': 0.40; 'skip:u 10': 0.61; '30,': 0.63; 'to:name:python': 0.84; 'dennis': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=nPCiOh4g7Eu+sgMQAHPthdqU+xwa12upXXBc1G3yXFE=; b=F8QFLer+04ySYA8LpayBBZuZAPlJiIprXjoX26UUfYKSp7IGozmebGXOJUC24Bpgbj dCwlPmLU16itq7n3wRqSGQewYzEgqQRXYPHfTZzmAHqUEixUxHS323MnEWa59Vqg1cM2 2YYU4IPnmVeNfwIsHIErXkw5CN5Dgv/+tnmKn8HSDtwQf9j8ISzg9K8XFYwuJYMMmzS6 6TEH/cuWCGh1WQqJ+JvVhJGcGXnlOvW2HnJ3Vnh6jW2ORNNjsW+dRPQE7ss0055yZ7UX UELbpvLbta1hIReFpEVchInnC8e0PYJ5ctpIkTVY94fV2niskbXDveMxroZSVW2VmXAI lGqw==
X-Received by 10.50.73.130 with SMTP id l2mr27495718igv.93.1448985259565; Tue, 01 Dec 2015 07:54:19 -0800 (PST)
In-Reply-To <pnup5bhvr6odj3suklt4sgnph6mdr2qh85@4ax.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:99804

Show key headers only | View raw


On Mon, Nov 30, 2015 at 7:44 PM, Dennis Lee Bieber
<wlfraed@ix.netcom.com> wrote:
> On Mon, 30 Nov 2015 10:55:23 -0800 (PST), fl <rxjwg98@gmail.com> declaimed
> the following:
>
>>Thanks Ian. I created the class because I want to use the original example
>>line
>>
>> UI.Button("button %s" % i, callback)
>>
>>Is there another way to use the above line without my class definition?
>>I do feel that my created class does not match well with the above line
>>because the first item "button %s" does not fit __self__ in the class.
>
>         The first item passed to a method call is the instance object... In
> this case, whatever "UI" is bound to.
>
>         If it helps, think of
>
>                 UI.Button("string", callback)
> as
>                 Button(UI, "string", callback)

This is only correct if "UI" is bound to an instance of a class and
"Button" is a method of that class. If UI is a class itself or a
module, then those are not equivalent.

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


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