[Python-ideas] [Wild Idea] Static Ducks

Lie Ryan lie.1296 at gmail.com
Sat Sep 26 18:15:23 CEST 2009


Dj Gilcrease wrote:
> On Mon, Sep 21, 2009 at 6:19 PM, Steven D'Aprano <steve at pearwood.info> wrote:
>> It sounds like what you want is a framework for hiding the complexity of
>> runtime type checkers from the developer. I don't think there's any
>> need for new syntax beyond decorators and the type annotations added to
>> Python 3. Type annotations give you a way of declaring types of
>> arguments and return results. Although such declarations are currently
>> ignored by Python, you can write code to enforce them, and decorators
>> give you a neat syntax for applying that code to your functions without
>> having to explicitly include the type checks inside the function body.
>> You can also do the same with metaclasses.
> 
> Ya but decorators, metaclasses and annotations dont address class
> attributes, or module level variables, which you should be able to
> type check on assignment, but you need to do it on use.

property()?




More information about the Python-ideas mailing list