[Python-3000] Conventions for annotation consumers (was: Re: Draft pre-PEP: function annotations) (original) (raw)
Paul Prescod paul at prescod.net
Tue Aug 15 21:30:36 CEST 2006
- Previous message: [Python-3000] Conventions for annotation consumers (was: Re: Draft pre-PEP: function annotations)
- Next message: [Python-3000] Conventions for annotation consumers (was: Re: Draft pre-PEP: function annotations)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 8/15/06, Collin Winter <collinw at gmail.com> wrote:
So basically what you're saying is that there would be a more-or-less standard wrapper for each application of function annotations.
No, I explicitly said that there may or may not arise standards based upon the existence or non-existence of community consensus and convergence of requirements. Just as there may or may not arise a standard Python web application framework depending on whether the community converges or does not.
How is
this significantly better than my dict-based approach, which uses standardised dict keys to indicate the kind of metadata?
The dict-based approach introduces an extra namespace to manage. What if two different groups start fighting over the keyword "type" or "doc" or "lock"? Python already has a module system that allows you to use the word "type" and me to use the word "type" without conflict (though I can't guarantee that it won't be confusing!). Python's module system allows renaming and abbreviating: both valuable features.
Also, the dict-based approach is just more punctuation to type. What is the dict equivalent for:
def foo(a: type(int)) -> type(int): ...
versus
def foo(a: {"type":int}) -> {"type": int}:
In my approach you could do this:
Int = type(int)
def foo(a: Int) -> Int
Paul Prescod -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-3000/attachments/20060815/8e7c6d23/attachment.htm
- Previous message: [Python-3000] Conventions for annotation consumers (was: Re: Draft pre-PEP: function annotations)
- Next message: [Python-3000] Conventions for annotation consumers (was: Re: Draft pre-PEP: function annotations)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]