Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
ast.parse
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Kiuhnm  
View profile  
 More options Apr 9 2012, 7:53 am
Newsgroups: comp.lang.python
From: Kiuhnm <kiuhnm03.4t.yahoo.it>
Date: Mon, 09 Apr 2012 13:53:21 +0200
Local: Mon, Apr 9 2012 7:53 am
Subject: ast.parse
Is it a known fact that ast.parse doesn't handle line continuations and
some multi-line expressions?
For instance, he doesn't like
     for (x,
          y) in each([1,
                      2]):
         print(1)
at all.
Is there a workaround besides "repairing" the code on the fly?

Kiuhnm


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Irmen de Jong  
View profile  
 More options Apr 9 2012, 8:43 am
Newsgroups: comp.lang.python
From: Irmen de Jong <irmen.NOS...@xs4all.nl>
Date: Mon, 09 Apr 2012 14:43:13 +0200
Local: Mon, Apr 9 2012 8:43 am
Subject: Re: ast.parse
On 9-4-2012 13:53, Kiuhnm wrote:

> Is it a known fact that ast.parse doesn't handle line continuations and some multi-line
> expressions?
> For instance, he doesn't like
>     for (x,
>          y) in each([1,
>                      2]):
>         print(1)
> at all.
> Is there a workaround besides "repairing" the code on the fly?

> Kiuhnm

What Python version are you using and what is the exact error? It works fine here
(Python 2.7.2):

>>> import ast
>>> code="""for (x,

...          y) in each([1,
...                      2]):
...         print(1)"""
>>> ast.parse(code)

<_ast.Module object at 0x02418A10>

Irmen


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kiuhnm  
View profile  
 More options Apr 9 2012, 9:57 am
Newsgroups: comp.lang.python
From: Kiuhnm <kiuhnm03.4t.yahoo.it>
Date: Mon, 09 Apr 2012 15:57:59 +0200
Local: Mon, Apr 9 2012 9:57 am
Subject: Re: ast.parse
On 4/9/2012 14:43, Irmen de Jong wrote:

Yes, it works. I was too hasty in blaming ast. Sorry.

Kiuhnm


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »