Fix Python – Which is more preferable to use: lambda functions or nested functions (‘def’)?

I mostly use lambda functions but sometimes use nested functions that seem to provide the same behavior.
Here are some trivial examples where they functionally do the same thing if either were found within another function:
Lambda function
>>> a = lambda x : 1 + x
>>> a(5)
6

Nested function
>>> def b(x): return 1 + x

>>> b(5)
6

Are there advant….

Fix Python – What is the syntax rule for having trailing commas in tuple definitions?

In the case of a single element tuple, the trailing comma is required.
a = (‘foo’,)

What about a tuple with multiple elements? It seems that whether the trailing comma exists or not, they are both valid. Is this correct? Having a trailing comma is easier for editing in my opinion. Is that a bad coding style?
a = (‘foo1’, ‘foo2’)
b = (‘foo1’, ‘foo….

Fix Python – String formatting named parameters?

I know it’s a really simple question, but I have no idea how to google it.
how can I do
print ‘%s‘ % (my_url)

So that my_url is used twice? I assume I have to “name” the %s and then use a dict in the params, but I’m not sure of the proper syntax?

just FYI, I’m aware I can just use my_url twice in the params, but that’s not the p….