did you know about extend ?

>>> mylist = []
>>> mylist.append(1)
>>> mylist
[1]
>>> mylist.append(2,3)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: append() takes exactly one argument (2 given)
>>> mylist.extend(2,3)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: extend() takes exactly one argument (2 given)
>>> mylist.extend([2,3])
>>> mylist
[1, 2, 3]




On Wednesday, June 20, 2012 8:03:41 AM UTC+2, Annet wrote:
>
> In a controller I have the following menu:
>
> response.site_submenu = []
> if session.vcardsettings:
>     response.site_submenu.append(
>     ['Logo',request.function=='uploadLogo',URL('uploadLogo')],
>     ['Tagline',request.function=='tagline',URL('tagline')],
>     ['Note',request.function=='note',URL('note')])
> elif session.sitesettings:
>     ...
>
> response.site_submenu.append(['Custom_theme',request.function=='customTheme',URL('customTheme')])
>
> This results in an error because .append() takes one argument not three. 
> Appending each menu item in a separate .append() solves the problem, but I 
> wonder whether there is another way to solve it>
>
> Kind regards,
>
> Annet
>

Reply via email to