pickling obscured function references
Hello all, I can't be the first to have thought of this, so there must be a reason this isn't the case, but I have to ask. Why is __main__ the fallback when pickle can't find a function reference? Instead of something like: os.path.basename(inspect.getsourcefile(func))[:-3] Thanks for humoring my curiosity, - Henry
On 2/18/2014 1:41 AM, Henry Harrison wrote:
I can't be the first to have thought of this, so there must be a reason this isn't the case, but I have to ask. Why is __main__ the fallback when pickle can't find a function reference?
Instead of something like: os.path.basename(inspect.getsourcefile(func))[:-3]
Thanks for humoring my curiosity,
A place to ask questions and 'humor curiosity' is python-list. Python-ideas is for ideas for improving future version of python. -- Terry Jan Reedy
On Feb 18, 2014, at 8:46, Terry Reedy <tjreedy@udel.edu> wrote:
On 2/18/2014 1:41 AM, Henry Harrison wrote:
I can't be the first to have thought of this, so there must be a reason this isn't the case, but I have to ask. Why is __main__ the fallback when pickle can't find a function reference?
Instead of something like: os.path.basename(inspect.getsourcefile(func))[:-3]
Thanks for humoring my curiosity,
A place to ask questions and 'humor curiosity' is python-list. Python-ideas is for ideas for improving future version of python.
I think he may have actually wanted to propose this change, but posted it in an overly tentative way so that if it was a bad idea (as, after all, most language change proposals are...), people would explain gently why it's a bad idea instead of just rejecting it out of hand. (I don't think it's a good idea to post that way on this list--in fact, it's likely to have the opposite of the intended effect--but I can understand why someone might expect it to be.)
participants (3)
-
Andrew Barnert -
Henry Harrison -
Terry Reedy