Re: [Python-ideas] pickling obscured function references
Apologies. Yes, I had in mind something in-between a proposal and a question, which in retrospect was not the way to go about it. And I was not aware of python-list, so apologies again for not researching the options for having this discussion. In any case after sleeping on it I'm pretty sure the answer to my question is "because backwards compatibility" which means that the proposal would be moot. Sorry again for wasting your time. - Henry
On Feb 18, 2014, at 8:46, Terry Reedy
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.)
Actually there's more to it -- the source filename of a function may not always be available, and whether it's available may depend on how it was loaded. It's also a burden for Python implementations other than Python, which may make such introspections much more expensive or at times impossible. On Tue, Feb 18, 2014 at 11:35 AM, Henry Harrison < henry.schafer.harrison@gmail.com> wrote:
Apologies. Yes, I had in mind something in-between a proposal and a question, which in retrospect was not the way to go about it. And I was not aware of python-list, so apologies again for not researching the options for having this discussion.
In any case after sleeping on it I'm pretty sure the answer to my question is "because backwards compatibility" which means that the proposal would be moot. Sorry again for wasting your time.
- Henry
On Feb 18, 2014, at 8:46, Terry Reedy
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.)
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/
-- --Guido van Rossum (python.org/~guido)
participants (2)
-
Guido van Rossum
-
Henry Harrison