On 06/15/2013 03:23 PM, Guido van Rossum wrote:
The semantics of raw strings are clear. I don't see that they should be
called out especially in any context. (Except for regexps.) Usually exec()
is not used with a literal anyway (what would be the point).
There are about a hundred instances of eval/exec(some_string_literal) in
pythons library. Most of them in the tests, and maybe about half of those
testing the compiler, eval, and exec.
egrep -owr --include="*.py" "(eval|exec)\(('.*'|\".*\")\)" * | wc -l
114
I have no idea in how many places a string literal is assigned to a name
first and then used later in eval or exec. It's harder to grep for but
would be less than...
egrep -owr --include="*.py" "(eval|exec)\(.*\)" * | wc -l
438
That's overstated because some of those are comments, and some may be
functions with the name ending with eval or exec.
I do think that eval and exec is a similar case to regexps. And possibly
often enough, the string may contain a raw string, regular expression, or a
file/path name.
Only a short note needed in the docs for eval, nothing more. And not even
that if no thinks it's an issue.
cheers,
Ron
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com