On Thu, Jan 31, 2013 at 7:45 PM, D. S. McNeil <dsm...@gmail.com> 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* for
>> Python 3, but then soundly rejected by Guido as "too ugly".
>
> I have good news -- I think you're misreading the current status:
>
> Python 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 01:25:11)
> [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
>>>> def f(a: int, b: float) -> (float, str):
> ...     pass
> ...
>>>> f.__annotations__
> {'b': <class 'float'>, 'return': (<class 'float'>, <class 'str'>),
> 'a': <class 'int'>}
>

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

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to