Re: [Python-ideas] More Metadata for Variable Annotations

2017-08-18 Thread Wes Turner
PyContracts supports things like numpy array constraints https://andreacensi.github.io/contracts/reference.html#contracts-language-reference > You can specify that the value must be a list, and specify optional constraints for its length and for its elements. ... You mentioned JSONschema. For RD

Re: [Python-ideas] More Metadata for Variable Annotations

2017-08-18 Thread Guido van Rossum
A similar approach (though only for class/instance variables) is taken by the 'attrs' package and by the proposal currently code-named "dataclasses" ( https://github.com/ericvsmith/dataclasses). On Fri, Aug 18, 2017 at 10:48 AM, Ivan Levkivskyi wrote: > Hi Bagrat, > > Thanks for a detailed propo

Re: [Python-ideas] More Metadata for Variable Annotations

2017-08-18 Thread Ivan Levkivskyi
Hi Bagrat, Thanks for a detailed proposal! Indeed, some projects might want to have some additional metadata attached to a variable/argument besides its type. However, I think it would be more productive to first discuss this on a more specialized forum like https://github.com/python/typing/issues

[Python-ideas] More Metadata for Variable Annotations

2017-08-18 Thread Bagrat Aznauryan
# Abstract Before the holly PEP-526 the only option for type hints were comments. And before PEP-484 the docstrings were the main place where variable metadata would go. That variable metadata would include: * the type * the human-readable description * some value constraints (e.g. a range for in