codegen
codegen copied to clipboard
Bugfixes: del-, try-except-, and import-as-syntax
While using codegen I noticed that the following code examples could not be parsed to an ast and then translated back again to source code with codegen:
# example 1
del l[0]
# example 2
del obj.x
# example 3
try:
'#'[2]
except IndexError:
print 'What did you expect?!'
# example 4
try:
l = []
l[1]
except IndexError, index_error:
print index_error
# example 5
import intertools as iterators
# example 6
from math import floor as fl, ceil as cl
So I forked the code, fixed these issues and now I'd like to contribute my fixes to the actual repository.
Thanks, @gemoe100 ! Although, I haven't decide yet whether to improve the original code or not. I use it for inlines only myself. If you need something better, please have a look at https://github.com/pmaupin/astor