Re: How to process syntax errors

2016-10-14 Thread Pierre-Alain Dorange
wrote: > Steve, You are absolutely right. I am trying to eliminate the method of > using parenthesis while calling in my file. Especially when I call it > from a instance. Then write a simple interpreter. You want to change the language syntax, as said previously, do not except python to underst

Re: How to process syntax errors

2016-10-12 Thread Terry Reedy
On 10/12/2016 5:59 AM, mr.puneet.go...@gmail.com wrote: # I created a platform class with different method in a file > # and making it as a package. class platform: def connect(self): # connect device def destroy(self): # destroy device def config(self, command):

Re: How to process syntax errors

2016-10-12 Thread sohcahtoa82
On Wednesday, October 12, 2016 at 3:01:26 AM UTC-7, mr.pune...@gmail.com wrote: > Hi All > > Its really good to see that some discussion happening around this topic. > Sorry I was out from my work for sometime so couldn't follow up but I really > find it useful. It gives me good opportunity to k

Re: How to process syntax errors

2016-10-12 Thread Rob Gaddi
mr.puneet.go...@gmail.com wrote: > On Monday, October 10, 2016 at 7:45:40 PM UTC+5:30, mr.pune...@gmail.com > wrote: >> Hi >> >> Is there any way to capture syntax errors and process them ? I want to write >> a function which calls every time whenever there is syntax error in the >> program.

Re: How to process syntax errors

2016-10-12 Thread Steve D'Aprano
On Thu, 13 Oct 2016 12:46 am, Pierre-Alain Dorange wrote: > Terry Reedy wrote: > >> > Using this function, the code is "compiled". >> > I do not think this function is often used and most python project >> > simply use the interpreter (which do a small translation into byte-code >> > to be faste

Re: How to process syntax errors

2016-10-12 Thread Chris Angelico
On Thu, Oct 13, 2016 at 12:46 AM, Pierre-Alain Dorange wrote: > Terry Reedy wrote: > >> > Using this function, the code is "compiled". >> > I do not think this function is often used and most python project >> > simply use the interpreter (which do a small translation into byte-code >> > to be fa

Re: How to process syntax errors

2016-10-12 Thread Pierre-Alain Dorange
Terry Reedy wrote: > > Using this function, the code is "compiled". > > I do not think this function is often used and most python project > > simply use the interpreter (which do a small translation into byte-code > > to be faster and check syntax error before running interpretation > > You see

Re: How to process syntax errors

2016-10-12 Thread Steve D'Aprano
On Wed, 12 Oct 2016 08:59 pm, mr.puneet.go...@gmail.com wrote: > Now person who wants to write a script using above package can simply use > below approach. Which does not make him to have knowledge in python. > > DUT = platform() > DUT connect > DUT config {commands} > DUT show {commands} > DUT

Re: How to process syntax errors

2016-10-12 Thread mr . puneet . goyal
On Monday, October 10, 2016 at 7:45:40 PM UTC+5:30, mr.pune...@gmail.com wrote: > Hi > > Is there any way to capture syntax errors and process them ? I want to write > a function which calls every time whenever there is syntax error in the > program. > > For example, > > inside example.py >

Re: How to process syntax errors

2016-10-12 Thread mr . puneet . goyal
Hi All Its really good to see that some discussion happening around this topic. Sorry I was out from my work for sometime so couldn't follow up but I really find it useful. It gives me good opportunity to know python better as I recently started learning python. Ok so I tell you why I need to

Re: How to process syntax errors

2016-10-11 Thread Terry Reedy
On 10/11/2016 4:02 AM, Pierre-Alain Dorange wrote: Using this function, the code is "compiled". I do not think this function is often used and most python project simply use the interpreter (which do a small translation into byte-code to be faster and check syntax error before running interpreta

Re: How to process syntax errors

2016-10-11 Thread Steve D'Aprano
On Tue, 11 Oct 2016 03:58 pm, Terry Reedy wrote: > On 10/10/2016 11:24 AM, Chris Angelico wrote: >> On Tue, Oct 11, 2016 at 1:13 AM, wrote: >>> Is there any way to capture syntax errors and process them ? I want to >>> write a function which calls every time whenever there is syntax error >>> in

Re: How to process syntax errors

2016-10-11 Thread Marko Rauhamaa
Chris Angelico : >>> > You're right, except that Python is never compiled, it was just >>> > checked for syntax error before interpreting code. >>> >>> https://docs.python.org/3/library/functions.html#compile >>> >>> It's compiled. >> >> Using this function, the code is "compiled". >> I do not thi

Python code is compiled before execution (was: How to process syntax errors)

2016-10-11 Thread Ben Finney
pdora...@pas-de-pub-merci.mac.com (Pierre-Alain Dorange) writes: > Chris Angelico wrote: > > > https://docs.python.org/3/library/functions.html#compile > > > > [Python code is] compiled. > > Using this function, the code is "compiled". You have it backward: Python code is compiled. That's what

Re: How to process syntax errors

2016-10-11 Thread Chris Angelico
On Tue, Oct 11, 2016 at 7:02 PM, Pierre-Alain Dorange wrote: > Chris Angelico wrote: > >> >> Yes and no. Syntax errors are detected when the script is compiled, so >> >> you can't do something like this: >> > >> > You're right, except that Python is never compiled, it was just checked >> > for sy

Re: How to process syntax errors

2016-10-11 Thread Pierre-Alain Dorange
Chris Angelico wrote: > >> Yes and no. Syntax errors are detected when the script is compiled, so > >> you can't do something like this: > > > > You're right, except that Python is never compiled, it was just checked > > for syntax error before interpreting code. > > https://docs.python.org/3/li

Re: How to process syntax errors

2016-10-10 Thread Terry Reedy
On 10/10/2016 11:24 AM, Chris Angelico wrote: On Tue, Oct 11, 2016 at 1:13 AM, wrote: Is there any way to capture syntax errors and process them ? I want to write a function which calls every time whenever there is syntax error in the program. However, you can catch this at some form of ou

Re: How to process syntax errors

2016-10-10 Thread breamoreboy
On Monday, October 10, 2016 at 3:15:40 PM UTC+1, mr.pune...@gmail.com wrote: > Hi > > Is there any way to capture syntax errors and process them ? I want to write > a function which calls every time whenever there is syntax error in the > program. > > For example, > > inside example.py > >

Re: How to process syntax errors

2016-10-10 Thread BartC
On 10/10/2016 16:44, Pierre-Alain Dorange wrote: Chris Angelico wrote: Yes and no. Syntax errors are detected when the script is compiled, so you can't do something like this: You're right, except that Python is never compiled, it was just checked for syntax error before interpreting code.

Re: How to process syntax errors

2016-10-10 Thread Chris Angelico
On Tue, Oct 11, 2016 at 2:44 AM, Pierre-Alain Dorange wrote: > Chris Angelico wrote: > >> Yes and no. Syntax errors are detected when the script is compiled, so >> you can't do something like this: > > You're right, except that Python is never compiled, it was just checked > for syntax error befo

Re: How to process syntax errors

2016-10-10 Thread Pierre-Alain Dorange
Chris Angelico wrote: > Yes and no. Syntax errors are detected when the script is compiled, so > you can't do something like this: You're right, except that Python is never compiled, it was just checked for syntax error before interpreting code. > > However, you can catch this at some form of

Re: How to process syntax errors

2016-10-10 Thread Chris Angelico
On Tue, Oct 11, 2016 at 1:13 AM, wrote: > Is there any way to capture syntax errors and process them ? I want to write > a function which calls every time whenever there is syntax error in the > program. > > For example, > > inside example.py > > I just mention below line > > > Obj = myClass()

How to process syntax errors

2016-10-10 Thread mr . puneet . goyal
Hi Is there any way to capture syntax errors and process them ? I want to write a function which calls every time whenever there is syntax error in the program. For example, inside example.py I just mention below line Obj = myClass() Obj xyz Obj is instance of a class. But there is synt