Got it.

That's why I need to unpack the list.

I even knew that. (palm to forehead)

On Wednesday, September 10, 2014 11:23:41 AM UTC-4, Anthony wrote:
>
> SELECT is not expected to behave like your printem() function, which 
> merely takes a list. SELECT can either take a list, or it can take a set of 
> positional arguments. In your case, however, you have passed it one 
> positional argument followed by a second positional argument that happens 
> to be a list. It is not designed to take inputs this way. Either give it a 
> single list (and no additional positional arguments):
>
> myselect = SELECT([OPTION('Choose')] + map(make_option, rows))
>
> or give it only individual positional arguments (using * to expand your 
> list into positional arguments):
>
> myselect = SELECT(OPTION('Choose'), *map(make_option, rows))
>
> Anthony
>
> On Wednesday, September 10, 2014 10:10:47 AM UTC-4, Cliff Kachinske wrote:
>>
>> Python does as below. SELECT does otherwise. I was curious as to why.
>>
>>
>> In [1]: foo = ['bar', 'baz', 'bazzle']
>>
>>
>> In [2]: def func(str):
>>    ...:     return 'fu{}'.format(str)
>>    ...: 
>>
>>
>> In [3]: map (func, foo)
>> Out[3]: ['fubar', 'fubaz', 'fubazzle']
>>
>>
>> In [4]: def printem(lis):
>>    ...:     for l in lis:
>>    ...:         print l
>>    ...:         
>>
>>
>> In [5]: printem(map(func, foo))
>> fubar
>> fubaz
>> fubazzle
>>
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to