I got the * and the ** explanations but António is asking about ***.
On Sep 14, 5:51 am, Anthony <abasta...@gmail.com> wrote: > In Python, if you have a list or tuple, you can precede it with an "*" and > pass it as an argument to a function, and the function will treat it as if > each item in the list were passed as a separate positional argument (same > thing for preceding a dictionary with "**", which will treat the dictionary > as a set of separate keyword arguments). > > In this example, 'rows' is a list, so TR(*rows) is like doing > TR(rows[0],rows[1]). In this case, it's not much shorter, but the *rowssyntax > is handy when rows > contains many elements, especially when the number of elements is determined > dynamically (e.g., with a database select). > > [TR(*rows) for rows in table] is a list comprehension, which results in a > list of TR objects, so the "*" preceding it is equivalent to: > > TABLE(TR(table[0][0],table[0][1]),TR(table[1][0],table[1][1])) > > Anthony > > > > > > > > On Tuesday, September 13, 2011 1:10:24 PM UTC-4, Ramos wrote: > > > Hello, i dont understant quite well how to interpret the *** in this > > code: > > > table = [['a', 'b'], ['c', 'd']] > > 2 >>> print TABLE(***[TR(***rows) for rows in table]) > > 3 <table><tr><td>a</td><td>b</td></tr><tr><td>c</td><td>d</td></tr></table> > > > Can someone please have the kindness to better understand it > > > I read the book but still not get it > > > thank you