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 catch syntax error during compilation and 
process them. See below example, 

# I created a platform class with different method in a file and making it as a 
class platform:
    def connect(self):
        # connect device 
    def destroy(self):
        # destroy device
    def config(self, command):
        # Send command to configure device
    def show(self, command):
        # check device health

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 destroy

But I know this is not easy to do in python. As they all invalid syntax for 
python language. So I thought of grabing syntax errors and manipulate them as 
below internally to call them while code is compiling. 

DUT = platform()

Hope you understand my need of doing this. If there is another solution to 
achieve what I am trying to. Please let me know. 

Thanks, Puneet

Reply via email to