[Python-ideas] Could the ast module's ASTs preserve source_length in addition to lineno and col_offset?

Haoyi Li haoyi.sg at gmail.com
Fri Jan 31 12:35:53 CET 2014


Nothing happened, I suppose. People in general thought it was a good idea
but after looking at the python source code, I chickened out of
implementing it in favor a dumb parse it till it
works<https://github.com/lihaoyi/macropy/blob/master/macropy/core/exact_src.py>
technique
which sufficed for my purposes.


On Fri, Jan 31, 2014 at 2:55 AM, Alexander Ivanov <alehander42 at gmail.com>wrote:

> What happened :? (I am also interested in getting source_length/col_last
> kind of info. Is there an alternative Python ast wrapper/library which
> provides it?)
>
> On Friday, May 31, 2013 4:47:15 PM UTC+3, Nick Coghlan wrote:
>>
>>
>> On 31 May 2013 20:00, "Haoyi Li" <haoy... at gmail.com> wrote:
>> >
>> > Ok, I'll give it a shot; I'm not familiar with the python codebase or
>> build process, but i'll puzzle it out. Where's the place to go for help
>> related to this sort of thing? python-dev?
>>
>> Check the developer guide at docs. python.org/devguide, and if you have
>> any follow-up questions, sign up to the core-me... at python.org list.
>>
>> Cheers,
>> Nick.
>>
>> >
>> >
>> > On Fri, May 31, 2013 at 1:04 AM, Nick Coghlan <ncog... at gmail.com>
>> wrote:
>>
>> >>
>> >>
>> >> On 31 May 2013 14:28, "Haoyi Li" <haoy... at gmail.com> wrote:
>> >> >
>> >> > Anyone else have any thoughts about this? This seems like it would
>> be a pretty straightforward thing to do, and I would be happy to go through
>> the code and submit a patch. The only question is whether we want to do it
>> in the first place; are there any reasons it can't/shouldn't be done that
>> I'm not aware of?
>> >>
>> >> Seems reasonable to me, but would need to see a patch to give a
>> definite yes or no.
>> >>
>> >> Cheers,
>> >> Nick.
>> >>
>> >> >
>> >> >
>> >> > On Wed, May 29, 2013 at 8:09 PM, Steven D'Aprano <
>> st... at pearwood.info> wrote:
>> >> >>
>> >> >> On 30/05/13 10:04, Haoyi Li wrote:
>> >> >>>
>> >> >>> I don't need to keep the source code, I just need a single integer
>> for each
>> >> >>> node. I would then be able to reconstruct the source snippet.
>> >> >>
>> >> >>
>> >> >> And so you did say. Sorry for the noise.
>> >> >>
>> >> >>
>> >> >> --
>> >> >> Steven
>> >> >> _______________________________________________
>> >> >> Python-ideas mailing list
>> >> >> Python... at python.org
>>
>> >> >> http://mail.python.org/mailman/listinfo/python-ideas
>> >> >
>> >> >
>> >> >
>> >> > _______________________________________________
>> >> > Python-ideas mailing list
>> >> > Python... at python.org
>> >> > http://mail.python.org/mailman/listinfo/python-ideas
>> >> >
>> >
>> >
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140131/3694e9d4/attachment.html>


More information about the Python-ideas mailing list