|
|
Log in / Subscribe / Register

The next 20 years of Python

The next 20 years of Python

Posted Jul 11, 2013 12:15 UTC (Thu) by smitty_one_each (subscriber, #28989)
In reply to: The next 20 years of Python by renox
Parent article: The next 20 years of Python

>languages with optional static typing

I'm curious how your comment differs from functionality available via
http://wiki.python.org/moin/PythonDecoratorLibrary#Type_E...


to post comments

The next 20 years of Python

Posted Jul 11, 2013 12:26 UTC (Thu) by mpr22 (subscriber, #60784) [Link] (2 responses)

Static typing isn't just about detecting passing an int to something that expects a float (or vice versa), it's about detecting passing a Penguin to something that expects a Duck. I concede that it may be the case that the decorator you linked to supports the latter check and just has laughably simplistic examples.

The next 20 years of Python

Posted Jul 11, 2013 14:09 UTC (Thu) by juliank (guest, #45896) [Link] (1 responses)

Well, it does, but it's still only a run-time check, and those are not very useful. And in Python 3, you can write things like:

def f(x: int, y: int, z: int) -> int:
return x * y * z

Combined with a decorator or a meta-class, you can use this for run-time type checking as well. But it's still only at run-time, and not static, at compile-time.

The next 20 years of Python

Posted Jul 22, 2013 6:28 UTC (Mon) by smurf (subscriber, #17840) [Link]

Well, Python isn't compiled, strictly speaking, so that's hardly a surprise.

However, once you do have those annotations, running an analyzer over the bytecode which verifies a large subset of them shouldn't be *that* hard to write.


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds