User: Password:
|
|
Subscribe / Log in / New account

Re: Make Python code read-only

From:  Nick Coghlan <ncoghlan-Re5JQEeQqe8AvxtiuMwx3w-AT-public.gmane.org>
To:  "Steven D'Aprano" <steve-iDnA/YwAAsAk+I/owrrOrA-AT-public.gmane.org>
Subject:  Re: Make Python code read-only
Date:  Wed, 21 May 2014 19:43:05 +1000
Message-ID:  <CADiSq7eTvgfJRCeQ2Z6F2n_G0h9HxjMsJLj3KUM5B6i52Sbs8w@mail.gmail.com>
Cc:  python-ideas-+ZN9ApsXKcEdnm+yROfE0A-AT-public.gmane.org
Archive-link:  Article

On 21 May 2014 11:48, "Steven D'Aprano" <steve-iDnA/YwAAsAk+I/owrrOrA@public.gmane.org> wrote:
>
> On Wed, May 21, 2014 at 03:37:42AM +1000, Chris Angelico wrote:
>
> > With that (rather big, and yet quite trivial) caveat, though: Looks
> > interesting. Optimizing for the >99% of code that doesn't do weird
> > things makes very good sense, just as long as the <1% can be catered
> > for.
>
> "99% of Python code doesn't do weird things..."
>
> It seems to me that this is a myth, or at least unjustifiable by the
> facts as we have seen it. Victor's experiment shows 25 modules from the
> standard library are modifiable, with 139 read-only. That's more like
> 15% than 1% "weird".

It also misses the big reason I am a Python programmer rather than a Java
programmer.

For me, Python is primarily an orchestration language. It is the language
for the code that is telling everything else what to do. If my Python code
is an overall performance bottleneck, then "Huzzah!", as it means I have
finally engineered all the other structural bottlenecks out of the system.

For this use case, monkey patching is not an incidental feature to be
tolerated merely for backwards compatibility reasons: it is a key
capability that makes Python an ideal language for me, as it takes ultimate
control of what dependencies do away from the original author and places it
in my hands as the system integrator. This is a dangerous power, not to be
used lightly, but it also grants me the ability to work around critical
bugs in dependencies at run time, rather than having to fork and patch the
source the way Java developers tend to do.

Victor's proposal is to make Python more complicated and a worse
orchestration language, for the sake of making it a better applications
programming language. In isolation, it might be possible to make that case,
but in the presence of PyPy for a full dynamically optimised runtime and
tools like Cython and Numba for selective optimisation within CPython, no.

Regards,
Nick.
_______________________________________________
Python-ideas mailing list
Python-ideas-+ZN9ApsXKcEdnm+yROfE0A@public.gmane.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

(Log in to post comments)


Copyright © 2014, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds