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


Groups > comp.lang.python > #7672

Re: What is the Most Efficient Way of Printing A Dict's Contents Out In Columns?

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'arguments': 0.05; 'mrab': 0.05; 'pointer': 0.05; 'terry': 0.07; 'arguments,': 0.09; 'arguments.': 0.09; 'dict': 0.09; 'operator,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'pm,': 0.10; 'essentially': 0.11; 'wrote:': 0.14; '**,': 0.16; 'inverse': 0.16; 'reedy': 0.16; 'subject: \n ': 0.16; 'subject:Out': 0.16; 'argument': 0.16; 'question.': 0.16; 'keyword': 0.19; 'jan': 0.20; 'header:In-Reply-To:1': 0.21; 'function': 0.25; 'subject:?': 0.29; 'header:X-Complaints-To:1': 0.32; 'to:addr:python-list': 0.33; 'list': 0.33; 'example,': 0.35; 'header:User-Agent:1': 0.35; 'subject:What': 0.35; 'for?': 0.37; 'received:org': 0.38; 'subject:: ': 0.38; 'header:Mime-Version:1': 0.39; 'to:addr:python.org': 0.39; 'collect': 0.62
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Terry Reedy <tjreedy@udel.edu>
Subject Re: What is the Most Efficient Way of Printing A Dict's Contents Out In Columns?
Date Wed, 15 Jun 2011 00:53:05 -0400
References <22011833-0833-4589-8326-909f4c57f1aa@a10g2000vbz.googlegroups.com> <mailman.222.1308067590.11593.python-list@python.org> <312107af-ee77-42ff-a8c5-8c32bd2976cf@f11g2000vbx.googlegroups.com> <4DF7AA67.2050100@mrabarnett.plus.com>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host rain.gmane.org
User-Agent Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.17) Gecko/20110414 Lightning/1.0b2 Thunderbird/3.1.10
In-Reply-To <4DF7AA67.2050100@mrabarnett.plus.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.257.1308113598.11593.python-list@python.org> (permalink)
Lines 21
NNTP-Posting-Host 82.94.164.166
X-Trace 1308113598 news.xs4all.nl 49048 [::ffff:82.94.164.166]:49763
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:7672

Show key headers only | View raw


On 6/14/2011 2:37 PM, MRAB wrote:
> On 14/06/2011 18:48, Zach Dziura wrote:
> [snip]
>> I just have one quick question. On the line where you have zip(*arr),
>> what is the * for? Is it like the pointer operator, such as with C? Or
>> is it exactly the pointer operator?
>>
> [snip]
> The * in the argument list of a function call unpacks the following
> list as arguments for the call, for example, zip(*[0, 1, 2]) becomes
> zip(0, 1, 2), so zip(*arr) becomes zip(arr[0], arr[1], ...).
>
> There's also **, which unpacks a dict as keyword arguments.

* and ** in a function call, which distribute arguments,
are essentially the inverse of * and ** in function definitions,
where they say to collect arguments.

-- 
Terry Jan Reedy

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


Thread

What is the Most Efficient Way of Printing A Dict's Contents Out In Columns? Zachary Dziura <zcdziura@gmail.com> - 2011-06-14 08:29 -0700
  Re: What is the Most Efficient Way of Printing A Dict's Contents Out In Columns? Terry Reedy <tjreedy@udel.edu> - 2011-06-14 12:06 -0400
    Re: What is the Most Efficient Way of Printing A Dict's Contents Out In Columns? Zach Dziura <zcdziura@gmail.com> - 2011-06-14 10:48 -0700
      Re: What is the Most Efficient Way of Printing A Dict's Contents Out In Columns? MRAB <python@mrabarnett.plus.com> - 2011-06-14 19:37 +0100
      Re: What is the Most Efficient Way of Printing A Dict's Contents Out In Columns? Terry Reedy <tjreedy@udel.edu> - 2011-06-15 00:53 -0400
  Re: What is the Most Efficient Way of Printing A Dict's Contents Out In Columns? Karim <karim.liateni@free.fr> - 2011-06-14 20:28 +0200
  Re: What is the Most Efficient Way of Printing A Dict's Contents Out In Columns? Ben Finney <ben+python@benfinney.id.au> - 2011-06-15 09:40 +1000
    Re: What is the Most Efficient Way of Printing A Dict's Contents Out In Columns? Chris Angelico <rosuav@gmail.com> - 2011-06-15 10:08 +1000

csiph-web