try catch - Python eval() exception handling in one line -


i programming irc bot in python. code in 1 line. know not how python programs should written, experimental. want execute oneliner scripts irc, don't know how handle exceptions.

is possible evaluate python expression , handle possible exceptions in 1 line? afaik try-except not work in 1 line.

here current code: http://pastebin.com/f34brq91. not easy read that, not necessary understand answer question. :)

no, there no way put exception handler in 1 line. can put simple statements on 1 line, , try - except compound statement.

there no functions that'll swallow exception you.

the way you'd able pull off in 1 line, create new code object raw bytes define bytecodes blanket try - except: pass construct. using bytecode go on create function swallows exceptions.

however, not going write 1 you. sorry.


Comments

Popular posts from this blog

php - get table cell data from and place a copy in another table -

javascript - Mootools wait with Fx.Morph start -

php - Navigate throught databse rows -