Python lookup function
问题 I want to set up a lookup function with mako. on top of the template, i have <%! lookup = { 'key': function } %> <%def name="function()"> Output </%def> so i can use it later <%def name="body()"> ${lookup['key']()} </%def> this gives me a function is not a defined error. can i get around this? i know why it doesn't work, as it runs first, before the method gets loaded, but how else would i set this up? 回答1: I can tell you why it isn't working, but I do not have a clean solution at this point.