Creating type evaluation annotation

Marek Mosiewicz marek.mosiewicz at jotel.com.pl
Sun Dec 9 07:01:35 EST 2018


I'm talking about this https://docs.python.org/3/library/typing.html

I'm not talking about new language. I think it could be nice to have
standard PEP annotations for classes to make type validation or type
hints when writing code. 

It would be best of two worlds. Dynamic language with optional type
chceking if somebody wants it. 

In Groovy language there is annotation to indicate that you can not
make calls to methods which do not exist.

It could go futher and you could have annotation which validates
whatever method signature if it is valid. For example you can have
valiadator for something like Ruby on Rails in Ruby language for
methods which starts with find:
invoice.find_by_name
invoice.find_by_name_and_description

It could be even better and give you type hints when you type
method name. In this example when you write in IDE:
invoice.find_by_
it would suggest you futher possible method parts and possible
parameters for method.

This class valiadtors would be optional and run only when developer
wants to validate or write code, not in production as it is heavy.



W dniu 06.12.2018, czw o godzinie 20∶06 +0000, użytkownik Jon Ribbens
napisał:
> On 2018-12-06, Marek Mosiewicz <marek.mosiewicz at jotel.com.pl> wrote:
> > I'm Java developer,but had some experience with Python based
> > ERP software. It is quite serious application and I feel 
> > unconfortable with not having type checking. I do not say language
> > should be static, but having checking method signature
> > is big win. For example in refactoring.
> > I know that Python 3 has possibility to have indicate
> > type for varibale or param
> 
> Are you talking about http://www.mypy-lang.org/ ?



More information about the Python-list mailing list