by bcbrown · 8y ago · 0 comments
>>> def recurse():
... return recurse
...
>>> recurse
<function recurse at 0x1083b5f28>
>>> recurse()
<function recurse at 0x1083b5f28>
>>> recurse()()()
<function recurse at 0x1083b5f28>Reminds me of the fact that Python doesn't have a char type and it's strings all the way down:
"a"[0][0][0][0] == "a"
Also, what does `recurse()()()` mean? What are we looking for exactly?
recurse == recurse()()()()...
It's more of an interesting observation than anything usefulThe syntax can occasionally be useful if you have a function the generates function, but then you'd be calling initial function with some argument like this:
f_x = f(x)()
f_y = f(y)()its just abusing a core mechanic.
a=[]
a.append(a)