[web2py] Re: TABLE--TR--TD in web2py book

2015-09-01 Thread Mamisoa Andriantafika
Ok now I get it. Thank you. Le mardi 1 septembre 2015 10:29:45 UTC+2, xmarx a écrit : > > This is a shortcut that allows you to pass multiple arguments to a > function directly list. source: > http://stackoverflow.com/questions/36901/what-does-double-star-and-star-do-for-python-parameters > > >

[web2py] Re: TABLE--TR--TD in web2py book

2015-09-01 Thread xmarx
This is a shortcut that allows you to pass multiple arguments to a function directly list. source: http://stackoverflow.com/questions/36901/what-does-double-star-and-star-do-for-python-parameters TABLE(*[TR(*rows) for rows in table]) TABLE is a function that can takes list argument. [TR(*ro

[web2py] Re: TABLE--TR--TD in web2py book

2015-08-31 Thread Mamisoa Andriantafika
Thank you for your highlight. You helped me to better understand the iteration. My main misunderstanding was actually the "*" before the "[(TR" ? Le lundi 31 août 2015 01:07:47 UTC+2, Anthony a écrit : > > [TR(*rows) for rows in table] is a list comprehension -- it iterates over > the items in

[web2py] Re: TABLE--TR--TD in web2py book

2015-08-30 Thread Anthony
[TR(*rows) for rows in table] is a list comprehension -- it iterates over the items in "table" (which are themselves lists) and creates a new list of TR objects. The "*" before the list is Python syntax for argument unpacking, treating each item in the list as if it were a separate positional a

[web2py] Re: TABLE--TR--TD in web2py book

2015-08-30 Thread Mamisoa Andriantafika
Doest the first star is needed? I think not? Le dimanche 30 août 2015 19:20:38 UTC+2, Mamisoa Andriantafika a écrit : > > Hi, > > Could you explain to me how this code works? > > http://web2py.com/books/default/chapter/29/05/the-views#TABLE--TR--TD > > >>> table = [['a', 'b'], ['c', 'd']] > >>> pr