What is the Most Efficient Way of Printing A Dict's Contents Out In Columns?
Terry Reedy
tjreedy at udel.edu
Wed Jun 15 00:53:05 EDT 2011
More information about the Python-list mailing list
Wed Jun 15 00:53:05 EDT 2011
- Previous message (by thread): What is the Most Efficient Way of Printing A Dict's Contents Out In Columns?
- Next message (by thread): What is the Most Efficient Way of Printing A Dict's Contents Out In Columns?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Previous message (by thread): What is the Most Efficient Way of Printing A Dict's Contents Out In Columns?
- Next message (by thread): What is the Most Efficient Way of Printing A Dict's Contents Out In Columns?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list