[sage-devel] Re: Sage Explorer / adding type information to functions

2013-01-31 Thread Jason Grout
On 1/31/13 4:37 PM, William Stein wrote: Unfortunately, type declarations, with that syntax, was*proposed* for Python 3, but then soundly rejected by Guido as "too ugly". That was referring to adding annotations about *generators*, according to the PEP (specifically using 'yields', 'is_sent',

Re: [sage-devel] Re: Sage Explorer / adding type information to functions

2013-01-31 Thread D. S. McNeil
> Ah, interesting. I guess Guido just didn't like part of the > notation.Note that the declaration doesn't actually do anything: > def f(a: int, b: float) -> (float, str): > ... print(a,b) > ... f(2.5,3) > 2.5 3 Yeah, IIRC enforcing this was a non-starter, and the decision was to

Re: [sage-devel] Re: Sage Explorer / adding type information to functions

2013-01-31 Thread William Stein
On Thu, Jan 31, 2013 at 7:45 PM, D. S. McNeil wrote: >>> As far as I understand, Python 3 will allow to achieve the same using >>> the natural syntax `def f(x: int, y: float) : ...`, with flexibility >>> on what "type" can be. >> >> Unfortunately, type declarations, with that syntax, was *proposed

Re: [sage-devel] Re: Sage Explorer / adding type information to functions

2013-01-31 Thread D. S. McNeil
>> As far as I understand, Python 3 will allow to achieve the same using >> the natural syntax `def f(x: int, y: float) : ...`, with flexibility >> on what "type" can be. > > Unfortunately, type declarations, with that syntax, was *proposed* for > Python 3, but then soundly rejected by Guido as "to

Re: [sage-devel] Re: Sage Explorer / adding type information to functions

2013-01-31 Thread William Stein
On Thu, Jan 31, 2013 at 6:04 AM, Nicolas M. Thiery wrote: > On Thu, Jan 31, 2013 at 10:40:14AM +0100, Julien Puydt wrote: >> Le 31/01/2013 10:29, Harald Schilly a écrit : >> >What's missing, in Sage, is a decorator for each method, which would >> >specify the input type. >> >> I thought that wasn'

Re: [sage-devel] Re: Sage Explorer / adding type information to functions

2013-01-31 Thread Nicolas M. Thiery
On Thu, Jan 31, 2013 at 10:40:14AM +0100, Julien Puydt wrote: > Le 31/01/2013 10:29, Harald Schilly a écrit : > >What's missing, in Sage, is a decorator for each method, which would > >specify the input type. > > I thought that wasn't really possible with python? There are a couple existing imple

[sage-devel] Re: Sage Explorer

2013-01-31 Thread Travis Scrimshaw
Hey everyone, On Thursday, January 31, 2013 4:54:52 AM UTC-5, Volker Braun wrote: > > I don't think we want to add decorators to each method. In fact, I > definitely don't :-) I agree. Plus how would this work with optional/variable-length arguments? (Also it gets away from the weakly typed na

[sage-devel] Re: Sage Explorer

2013-01-31 Thread Volker Braun
I don't think we want to add decorators to each method. In fact, I definitely don't :-) A saner approach would be to leverage our existing doctests. Just go through the AST and see which methods are being called directly in doctests. Then, as you execute the doctests, save the types of the arg

Re: [sage-devel] Re: Sage Explorer

2013-01-31 Thread Harald Schilly
On Thu, Jan 31, 2013 at 10:40 AM, Julien Puydt wrote: > I thought that wasn't really possible with python? Well, not directly, but one could define and add a decorator that just attaches a hidden attribute, like, ".__argument_specification" to the method or function. then, one could read that li

Re: [sage-devel] Re: Sage Explorer

2013-01-31 Thread Julien Puydt
Le 31/01/2013 10:29, Harald Schilly a écrit : What's missing, in Sage, is a decorator for each method, which would specify the input type. I thought that wasn't really possible with python? Snark on #sagemath -- You received this message because you are subscribed to the Google Groups "sage-

[sage-devel] Re: Sage Explorer

2013-01-31 Thread Harald Schilly
On Wednesday, January 30, 2013 10:04:49 PM UTC+1, Nicolas M. Thiéry wrote: > > Future > -- > Just my 2 cents: When I saw it, I liked that it doesn't rely on javascript (ok, well, formula rendering), and had a linear top-down layout (by accident). This led me to the conclusion that it co

[sage-devel] Re: Sage Explorer

2013-01-30 Thread Jason Grout
On 1/30/13 11:35 PM, William Stein wrote: It's a normal control at that point -- it sends a message back to the server and calls the function f. One thing is that it does*not* try to pass m into f. The interact object can tell you which variable(s) triggered a called, and of course you can get

Re: [sage-devel] Re: Sage Explorer

2013-01-30 Thread William Stein
On Wed, Jan 30, 2013 at 9:29 PM, Jason Grout wrote: > On 1/30/13 10:53 PM, William Stein wrote: >> >> On Wed, Jan 30, 2013 at 7:49 PM, Nicolas M. Thiery >> wrote: >>> >>> Hi William! >>> >>> On Wed, Jan 30, 2013 at 05:33:57PM -0800, William Stein wrote: Can I ask one quick ques

[sage-devel] Re: Sage Explorer

2013-01-30 Thread Jason Grout
On 1/30/13 10:53 PM, William Stein wrote: On Wed, Jan 30, 2013 at 7:49 PM, Nicolas M. Thiery wrote: Hi William! On Wed, Jan 30, 2013 at 05:33:57PM -0800, William Stein wrote: Can I ask one quick question? This is *NOT* meant to be a rhetorical question (though it could incorrectly b