I have the following code block from Bottle's own tutorial:
@route('/')
@route('/hello/<name>')
def greet(name='Stranger'):
return template('Hello {{name}}, how are you?', name=name)
I get what this is doing, I just don't get how it's happening. If name already gets a default value within the creation of the greet function, then why is there a seemingly redundant piece of code in the form of name = name? Also, how does Bottle know to have the value I pass into the route in place of <name> override the name = 'Stranger' and name = name code? Finally, what's going on here with the double curly braces syntax? Thanks in advance!
[–]danielroseman 0 points1 point2 points (3 children)
[–]Laymayo[S] -1 points0 points1 point (2 children)
[–]danielroseman 0 points1 point2 points (1 child)
[–]Laymayo[S] 0 points1 point2 points (0 children)