Closed GoogleCodeExporter closed 8 years ago
thanks for reporting.. but how would type() be useful, if the thing that goes
into it has to be statically typed (or shedskin won't compile the code
anyway)..?
Original comment by mark.duf...@gmail.com
on 18 Jan 2011 at 5:05
Hi,
With my tests, OptParser for example uses type() to know what to return. There
is a "type" module that defines some special case (None => NoneType...)
Without type() function, lot of modules cannot be compiler (or modified to be
compatible)
Original comment by Metal3d
on 19 Jan 2011 at 1:04
yes, and that's fine with me.. :-) shedskin really isn't meant to compile
arbitrary code. it's a tool that allows you to write really fast code, as long
as you're willing to sacrifice some python features.. in many cases, shedskin
-e allows you to incorporate this into larger, unrestricted, programs. several
programs in the example set use pygame, multiprocessing, pygame in this way..
Original comment by mark.duf...@gmail.com
on 19 Jan 2011 at 1:13
I meant pygame, multiprocessing and pygtk..
Original comment by mark.duf...@gmail.com
on 19 Jan 2011 at 1:14
It's ok, but this can be usefull to have some "types" instrospection abilities
I guess... no ?
Original comment by Metal3d
on 19 Jan 2011 at 1:17
yeah, but because of the static typing restriction, their use will always
remain rather limited.. they may be useful when dealing with inheritance
hierarchies (to determine which subclass are we dealing with, for a given
static base class), but that's about it. 'isinstance' actually already works
for this, and I guess we could implement 'type' in the same way..
Original comment by mark.duf...@gmail.com
on 19 Jan 2011 at 1:25
If ShedSkin wanted to be really clever it could compile the function to
something like:
def make_negative(object interger):
raise Exception('"interger" is not an interger!')
def make_negative(int interger):
return (-1)*interger
Not sure where that would fit on the doable scale though, along with being low
on the wanted scale.
Original comment by testo....@gmail.com
on 15 Feb 2011 at 8:24
shedskin supported generic functions/classes a long time ago, but I ended up
ripping it out (and never regretted that decision), because it complicated lots
of things and was never very useful, or it could easily be worked around..
in any case, splitting functions based on how they use 'type' or 'isinstance'
sounds like it's too clever.. :-)
Original comment by mark.duf...@gmail.com
on 27 Feb 2011 at 12:45
Original issue reported on code.google.com by
sears....@gmail.com
on 17 Jan 2011 at 10:44