<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"
	>
<channel>
	<title>Comments on: Function.apply (is even easier) in Python</title>
	<atom:link href="http://aralbalkan.com/1442/feed" rel="self" type="application/rss+xml" />
	<link>http://aralbalkan.com/1442</link>
	<description>Passionate geekisms.</description>
	<lastBuildDate>Sun, 12 Feb 2012 17:52:56 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: vjeux</title>
		<link>http://aralbalkan.com/1442/comment-page-1#comment-261371</link>
		<dc:creator>vjeux</dc:creator>
		<pubDate>Wed, 22 Sep 2010 08:46:13 +0000</pubDate>
		<guid isPermaLink="false">http://aralbalkan.com/1442#comment-261371</guid>
		<description>Thanks! Been really useful.

I did not understand what you were saying at start. Here&#039;s a little recap:

func(*[a, b])
func(a, b)

func(**{key: value})
func(key=value)</description>
		<content:encoded><![CDATA[<p>Thanks! Been really useful.</p>
<p>I did not understand what you were saying at start. Here&#8217;s a little recap:</p>
<p>func(*[a, b])<br />
func(a, b)</p>
<p>func(**{key: value})<br />
func(key=value)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jesse</title>
		<link>http://aralbalkan.com/1442/comment-page-1#comment-260577</link>
		<dc:creator>Jesse</dc:creator>
		<pubDate>Sun, 20 Jun 2010 04:48:56 +0000</pubDate>
		<guid isPermaLink="false">http://aralbalkan.com/1442#comment-260577</guid>
		<description>The second part of the awesomeness is that if you want a function bound to a particular scope (thisObj) you only need to call thisObj.function(*args, **kwargs).

thisObj.function is always bound to the scope thisObj. You can also use an unbound method and bind it later by passing in an additional first argument for self, e.g.:

class Foo(object):
  bar = &quot;&quot;

  def __init__(self, bar):
    self.bar = bar

  def foo(self):
    return self.bar

f = Foo(&quot;bar&quot;)
print &quot;bound method Foo(&#039;bar&#039;).foo() %s&quot; % f.foo()
print &quot;unbound method Foo.foo(f) %s&quot; % Foo.foo(f)</description>
		<content:encoded><![CDATA[<p>The second part of the awesomeness is that if you want a function bound to a particular scope (thisObj) you only need to call thisObj.function(*args, **kwargs).</p>
<p>thisObj.function is always bound to the scope thisObj. You can also use an unbound method and bind it later by passing in an additional first argument for self, e.g.:</p>
<p>class Foo(object):<br />
  bar = &#8220;&#8221;</p>
<p>  def __init__(self, bar):<br />
    self.bar = bar</p>
<p>  def foo(self):<br />
    return self.bar</p>
<p>f = Foo(&#8220;bar&#8221;)<br />
print &#8220;bound method Foo(&#8216;bar&#8217;).foo() %s&#8221; % f.foo()<br />
print &#8220;unbound method Foo.foo(f) %s&#8221; % Foo.foo(f)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aral</title>
		<link>http://aralbalkan.com/1442/comment-page-1#comment-174853</link>
		<dc:creator>Aral</dc:creator>
		<pubDate>Thu, 07 Aug 2008 17:33:31 +0000</pubDate>
		<guid isPermaLink="false">http://aralbalkan.com/1442#comment-174853</guid>
		<description>@widged: Yep, but it&#039;s not the same thing. That&#039;s the way I&#039;d been using extended call syntax in Python not understanding that you can also _call_ it via an argument object. 

For it to be equivalent, we should be able to do the following in AS3 (based on your example):

args = [1,2,3]
myFunc = function(x,y,z){
   trace(x + &quot;, &quot; + y + &quot;, &quot; + z)
}
myFunc(...args) 

or, borrowing Python syntax: myFunc(*args)

We can&#039;t do that yet in AS3.

That said, Python and AS3 are very similar in flavor (both dynamic languages) and we do have apply which does the same thing. I just find Python&#039;s syntax more concise in this case and quite elegant.</description>
		<content:encoded><![CDATA[<p>@widged: Yep, but it&#8217;s not the same thing. That&#8217;s the way I&#8217;d been using extended call syntax in Python not understanding that you can also _call_ it via an argument object. </p>
<p>For it to be equivalent, we should be able to do the following in AS3 (based on your example):</p>
<p>args = [1,2,3]<br />
myFunc = function(x,y,z){<br />
   trace(x + &#8220;, &#8221; + y + &#8220;, &#8221; + z)<br />
}<br />
myFunc(&#8230;args) </p>
<p>or, borrowing Python syntax: myFunc(*args)</p>
<p>We can&#8217;t do that yet in AS3.</p>
<p>That said, Python and AS3 are very similar in flavor (both dynamic languages) and we do have apply which does the same thing. I just find Python&#8217;s syntax more concise in this case and quite elegant.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bsdemon</title>
		<link>http://aralbalkan.com/1442/comment-page-1#comment-174781</link>
		<dc:creator>bsdemon</dc:creator>
		<pubDate>Thu, 07 Aug 2008 11:32:03 +0000</pubDate>
		<guid isPermaLink="false">http://aralbalkan.com/1442#comment-174781</guid>
		<description>widged:
In python can also do that by:

def func(*args):
    # now `args` is a tuple
    print length(args)
    print args</description>
		<content:encoded><![CDATA[<p>widged:<br />
In python can also do that by:</p>
<p>def func(*args):<br />
    # now `args` is a tuple<br />
    print length(args)<br />
    print args</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: widged</title>
		<link>http://aralbalkan.com/1442/comment-page-1#comment-174777</link>
		<dc:creator>widged</dc:creator>
		<pubDate>Thu, 07 Aug 2008 11:11:20 +0000</pubDate>
		<guid isPermaLink="false">http://aralbalkan.com/1442#comment-174777</guid>
		<description>Hi Aral,

Note that in AS3 you can now pass a variable number of arguments to the function itself:

function passAnything(...statements):void {
  trace(statements.length +&quot;: &quot;+ statements);
}

[Example borrowed from this &lt;a href=&quot;http://www.senocular.com/flash/tutorials/as3withflashcs3/&quot; rel=&quot;nofollow&quot;&gt;AS3 tutorial by senocular&lt;/a&gt;]</description>
		<content:encoded><![CDATA[<p>Hi Aral,</p>
<p>Note that in AS3 you can now pass a variable number of arguments to the function itself:</p>
<p>function passAnything(&#8230;statements):void {<br />
  trace(statements.length +&#8221;: &#8220;+ statements);<br />
}</p>
<p>[Example borrowed from this <a href="http://www.senocular.com/flash/tutorials/as3withflashcs3/" rel="nofollow">AS3 tutorial by senocular</a>]</p>
]]></content:encoded>
	</item>
</channel>
</rss>

