codegen icon indicating copy to clipboard operation
codegen copied to clipboard

Bugfixes: del-, try-except-, and import-as-syntax

Open gemoe100 opened this issue 12 years ago • 1 comments

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.

gemoe100 avatar Apr 04 '13 13:04 gemoe100

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

andreif avatar Apr 05 '13 21:04 andreif