From: Greg McIntyre Date: 2003-03-22T23:28:36+09:00 Subject: Re: Strong advantages over Python Paul Prescod wrote: > Joel VanderWerf wrote: > > ... > > icon = Icon.new(...) > > > > SliderControl.new("Horizontal position") do |new_x| > > icon.move_to(new_x, icon.y) > > end > > > > Could this be made so elegant in Python? > > It's almost identical in Python. > > > icon = Icon(...) > > slider = SliderControl("Horizontal position", > lambda new_x: icon.move_to(new_x, icon.y)) What about this? icon1 = Icon.new(...) icon2 = Icon.new(...) SliderControl.new("Horizontal position") do |new_x| icon1.move_to(new_x, icon.y) icon2.move_to(new_x, icon.y) end AFAIK, this cannot be done elegantly with a Python lambda. -- Greg McIntyre greg@puyo.cjb.net http://puyo.cjb.net