This *is* much better indeed :)

My moaning about Python(2) was apparently “snow of yesterday”. Python3 just came out featuring extended iterable unpacking.

  1 Python 3.0rc1+ (py3k, Oct 28 2008, 09:22:29)
  2 [GCC 4.3.2] on linux2
  3 Type "help", "copyright", "credits" or "license" for more information.
  4  >>> def f(a, b, c):
  5  ...   print('%s, %s, %s' % (a, b, c))
  6 ...
  7  >>> f(1,2,3)
  8 1, 2, 3
  9  >>> f(1,*(2,3))
 10 1, 2, 3
 11  >>> f(*(1,2),3)
 12   File "<stdin>", line 1
 13 SyntaxError: only named arguments may follow *expression
 14  >>> f(*(1,2),c=3)
 15 1, 2, 3

Hmm, not ideal but it does the job :-)

About these ads

One thought on “This *is* much better indeed :)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s