Eliminate intermediate variables
Not yet sure if this is considered idiomatic web2py or Python, but you can replace this:
from gluon.tools import Crud def new(): crud = Crud(db) form = crud.create(db.todo) return dict(form=form)
With this, which eliminates a variable and saves a function call. Probably considered more C style than Python:
from gluon.tools import Crud def new(): return dict(form=Crud(db).create(db.todo))
Recent Comments