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


Groups > comp.lang.python > #99763

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

From Dennis Lee Bieber <wlfraed@ix.netcom.com>
Newsgroups comp.lang.python
Subject Re: Question about code writing '% i, callback'
Date 2015-11-30 20:44 -0500
Organization IISS Elusive Unicorn
Message-ID <mailman.50.1448934253.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>

Show all headers | View raw


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)

-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
    wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

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