Closed GoogleCodeExporter closed 8 years ago
thanks for the suggestion. I have to say this looks a bit like a special-case,
and I'm not sure I'd be interested in adding complexity for this..
Original comment by mark.duf...@gmail.com
on 9 Jul 2010 at 8:40
Original comment by mark.duf...@gmail.com
on 9 Jul 2010 at 3:25
As an alternative to adding this feature into shedskin's parser, one could
create a copy of the code and replace all the function/method code with 'pass'
and shedskin that.
Making that automatic wouldn't be very hard, but removing the code done in a
class's declaration would require human interaction in many cases to replace,
say, "model_name = settings.MODEL_NAME" with "model_name = ''" or similar cases.
Original comment by fahh...@gmail.com
on 3 Oct 2010 at 10:39
I'm afraid type inference will not work very well for such 'partial' code. for
example, if all calls to some function disappear, there's not enough
information to analyze its signature..
Original comment by mark.duf...@gmail.com
on 4 Oct 2010 at 8:09
That's true, what I've been doing is move all calls and their context into the
__main__ portion and have the function set defaults to its args and return
something like it normally would, like so:
#Original code
def read_file(filename='pos.csv'):
data = open(filename)
# infering...
ox=oy=oz = [0.,0.,0.]
lx=ly=lz = '1'
line = ''
ox,oy,oz = [],[],[]
while True:
line = data.readline()
if line == '': break # only if EOF hit immediately
try:
lx,ly,lz = line.strip().split(' ')
except: continue # empty line
ox.append(float(lx))
oy.append(float(ly))
oz.append(float(lz))
return ox,oy,oz
#'Stub' Code
def read_file(filename='pos.csv'):
ox=oy=oz = [0.,0.,0.]
return ox,oy,oz
if __name__=='__main__':
posx,posy,posz = read_file('pos.csv')
Yes, there are some type-hints I provided to speed up shedskin.
Original comment by fahh...@gmail.com
on 16 Oct 2010 at 4:06
I guess there's not much difference between the original and stubbed code when
one just wants C++ stubs: one still has to remove generated fake code, and the
generated code is still quite ugly and can't be influenced..
Original comment by mark.duf...@gmail.com
on 18 Oct 2010 at 2:25
I appreciate the issue, but I think I will close it. I like shedskin to have a
lot of focus, because it's a complicated and still experimental project, with
only one active contributor. I also think we should focus on trying to avoid
the need for manual C++ completely, rather than aiding it.. ;-) but thanks
again for the suggestion.
Original comment by mark.duf...@gmail.com
on 27 Oct 2010 at 1:51
Original issue reported on code.google.com by
edgi...@gmail.com
on 8 Jul 2010 at 4:11