You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 28, 2022. It is now read-only.
I'm trying to do (in viewdom) an example of looping using a list comprehension. I was combining this with docs about Context and avoiding passing a value (in this case, prefix) down the component tree:
defTodo(label,prefix):
returnhtml('<li>{prefix}{label}</li>')defTodoList(prefix,todos):
returnhtml('<ul>{[Todo(label, prefix) for label in todos]}</ul>')
This gives:
usage/examples/componentsH.py:12: in TodoList
return html('<ul>{[Todo(label, prefix) for label in todos]}</ul>')
../../.venv/lib/python3.8/site-packages/tagged/__init__.py:84: in __tag
values.append(eval(expr, f_globals, f_locals))
:1: in <module>
???
:1: in <listcomp>
???
E NameError: name 'prefix' is not defined
Should a value in the scope of a function be available to a list comprehension?
The text was updated successfully, but these errors were encountered:
I'm trying to do (in
viewdom
) an example of looping using a list comprehension. I was combining this with docs aboutContext
and avoiding passing a value (in this case,prefix
) down the component tree:This gives:
Should a value in the scope of a function be available to a list comprehension?
The text was updated successfully, but these errors were encountered: