[Python-ideas] Make Python code read-only
Peter Mawhorter
pmawhorter at gmail.com
Tue May 20 19:36:51 CEST 2014
On Tue, May 20, 2014 at 10:22 AM, <dw+python-ideas at hmmz.org> wrote:
> On Tue, May 20, 2014 at 06:57:53PM +0200, Victor Stinner wrote:
>
>> * With read-only code, monkey-patching cannot be used anymore. It's
>> annoying to run tests. An obvious solution is to disable read-only
>> mode to run tests, which can be seen as unsafe since tests are usually
>> used to trust the code.
>
> At least for me, this represents a material change to the philosophy of
> the language. While frowned upon, monkey patching is extremely useful
> while debugging, and occasionally in emergencies. :)
>
> Definitely not worth it for a few extra % IMHO
>
> David
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
I think part of the point was that this read-only mode would be
entirely optional. One of the main reasons that I don't use Python for
all of my projects is the speed issue, so anything that's a "free"
speedup seems like a great thing. The main cost I can see here is in
maintaining the readonly mode and the perhaps subtle bugs that would
arise in many people's code when run in readonly mode. As an official
feature, there would be a documentation and maintenance cost to the
community, but I do think that there's substantial benefit, and
especially as an opt-in feature, if the optimizations really speed
things up, this seems quite useful. I guess the question is: How does
this compare to other "drop-in" speedup solutions, like PyPy. Is it
applicable to more existing code? Is it easier to apply? Does it
provide a better speed increase?
If there's a niche for it in one of those three areas and it's an
opt-in system, I see the issue being a cost-benefit analysis of what
is gained (whatever that niche is) vs. the maintenance cost in terms
of bug reports etc.
-Peter Mawhorter
More information about the Python-ideas
mailing list