alex-bender / dev-null

/dev/null holds misc ideas
0 stars 0 forks source link

Python debug list comprepension #73

Open alex-bender opened 5 years ago

alex-bender commented 5 years ago

write a function for detecting list comprehension and converting it into regular for loop

[int(x) for x in range(10)] => 
res = []
for x in range(10):
    try:
        res.append(int(x))
    except Exception as error:
        _GLOBAL = error
        print('got exception: ', error)