x = outfile.close # Assigns the function close to x
outfile.close # Usually an error, but returns the close function (does NOT call the function)
# When is anything like this useful?
debug = print
debug(x, y, z) # prints values of x, y and z but also makes clear this is just for debugging not a “real” print statement we need to keep.
# Another case : a function may have a long name collaborate_and_materialize( )
snappy = collaborate_and_materialize # Now you can call it using snappy
# Ideally, python should issue a gentle warning for outfile.close # Did you mean to call the close function? if so, do outfile.close()
Dave
> To view this discussion on the web visit
https://groups.google.com/a/anaconda.com/d/msgid/anaconda/CAAmTvGWJBPz-BVBgpGpEdiHOkhoj63J_cDwcU1nw1K1qC2%3Doyw%40mail.gmail.com.