I have functions like this:
def activate_field_1():
print 1
def activate_field_2():
print 2
def activate_field_3():
print 3
How do I define activate_field_[x] for x=1:10, without typing out each one of them? I’d much rather pass a parameter, of course, but for my purposes this is not possible.
Do you want to define these individually in your source file, statically? Then your best option would be to write a script to generate them.
If on the other hand you want these functions at runtime you can use a higher order function. For e.g.
You can generate a list of these and store, again at runtime.