[Python-Dev] Reading Python source file

Hrvoje Niksic hrvoje.niksic at avl.com
Wed Nov 18 10:57:31 EST 2015


On 11/18/2015 04:48 PM, Guido van Rossum wrote:
> That trick doesn't work unless the data looks like Python comments or
> data (e.g. a docstring). Python has always insisted on being able to
> parse until EOF. The only extreme case would be a small script
> followed by e.g. 4 GB of comments (where the old parser would indeed
> be more efficient). But unless you can point me to an occurrence of
> this in the wild I'm going to speculate that you just made this up
> based on the shell analogy (which isn't perfect).

If this never really worked in Python, feel free to drop the issue. I 
may be misremembering the language in which scripts I saw using this 
techniques years ago were written - most likely sh or Perl.

Hrvoje



More information about the Python-Dev mailing list