[Python-ideas] Optional static typing -- the crossroads

Ryan rymg19 at gmail.com
Sun Aug 17 16:09:07 CEST 2014


Nimrod has that feature, too, which makes type lists easier on the eyes.

Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
>Nicholas Cole wrote:
>> On Sun, Aug 17, 2014 at 3:08 AM, Steven D'Aprano
><steve at pearwood.info> wrote:
>> 
>>>    def __init__(self,
>>>            description:str, sec_code:str,
>>>            vendor_name:str, vendor_inv_num:str,
>>>            vendor_rtng:str, vendor_acct:str,
>>>            transaction_code:str, vendor_acct_type:str,
>>>            amount:int, payment_date:Any)->None:
>>
>>I had to stare at that block of
>> code for a long time to see how many and what type of arguments it
>> called.
>
>Pascal's function signature syntax had a nice feature
>that everyone else seems to have forgotten about. If you
>had multiple parameters of the same type, you only had
>to write the type once:
>
>     procedure Init(description, sec_code, vendor_name,
>         vendor_inv_num, vendor_rtng, vendor_acct,
>         transaction_code, vendor_acct_type, amount: str;
>         payment_date: Any)
>
>Disappointingly, Python's annotations make the same
>blunder as C, and most other languages since, in
>requiring each parameter to have its own individual
>annotation.
>
>-- 
>Greg
>_______________________________________________
>Python-ideas mailing list
>Python-ideas at python.org
>https://mail.python.org/mailman/listinfo/python-ideas
>Code of Conduct: http://python.org/psf/codeofconduct/

-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140817/ffb439f7/attachment.html>


More information about the Python-ideas mailing list