poppopjmp / shedskin

Automatically exported from code.google.com/p/shedskin
0 stars 0 forks source link

Support for function annotations #105

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I don't know if you have seen this http://www.python.org/dev/peps/pep-3107/

Once the project supports Python 3, it would be very interesting to use it to 
give type hits to Shed Skin without actually having to have functions being 
call somewhere.

I would guess that this bug will sit open for a long time, as I don't think 
Python 3 support is planed any time in the near future.

Original issue reported on code.google.com by testo....@gmail.com on 23 Oct 2010 at 5:52

GoogleCodeExporter commented 8 years ago

Original comment by mark.duf...@gmail.com on 23 Oct 2010 at 3:21

GoogleCodeExporter commented 8 years ago
thanks for mentioning! I have to say I'm not a big fan of type declarations 
(this is actually why I started shed skin!), but perhaps it can be useful later 
on to simplify building extension modules, where not everything may be easily 
callable from "the inside".. 

you are correct in saying that python 3 support is not planned anytime soon, 
but there are other ways one can give hints in python 2.x. assert statements 
are possible, you can probably do something with decorators, and there are also 
existing standards to provide hints inside docstrings.. and we could probably 
also use cython type declarations.

perhaps you'd be interested in having a look at the example programs that are 
compiled as extension modules (see examples/README). none of them really suffer 
from the fact that we don't have type hints..

in any case, I'm marking this as a duplicate of issue 94. I will mention this 
issue there.

Original comment by mark.duf...@gmail.com on 27 Oct 2010 at 1:24

GoogleCodeExporter commented 8 years ago
Totally agree, I dislike unneeded type declarations.  But for the few cases 
where it can't be computed it might be useful and in this case the code remains 
valid python syntax, and it is not a hacky solution. Actually the kind of thing 
the pep suggests it for.

I understand it is something you might never want to put in, but I thought I 
would put on the table as a possibility instead of other solutions.

Original comment by testo....@gmail.com on 28 Oct 2010 at 1:43