<div dir="ltr">Maybe that point of interest could be solved by using some kind of type class/interface(in the Obj C/Java sense). That way, external types that the user has no control of can be added to the interface.</div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Aug 16, 2014 at 3:22 PM, Ethan Furman <span dir="ltr"><<a href="mailto:ethan@stoneleaf.us" target="_blank">ethan@stoneleaf.us</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
As a test case for what code may soon look like, here's a bit from one of my code bases:<br>
<br>
<br>
------------------------------<u></u>------------------------------<u></u>--------<br>
class ACHPayment(object):<br>
"""A single payment from company to a vendor."""<br>
<br>
def __init__(self,<br>
description, sec_code,<br>
vendor_name, vendor_inv_num, vendor_rtng, vendor_acct,<br>
transaction_code, vendor_acct_type, amount, payment_date):<br>
"""<br>
description: 10 chars<br>
sec_code: 'CCD' or 'CTX'<br>
vendor_name: 22 chars<br>
vendor_inv_num: 15 chars<br>
vendor_rtng: 9 chars<br>
vendor_acct: 17 chars<br>
transaction_code: ACH_ETC code (enum)<br>
vendor_acct_type: 'domestic' or 'foreign'<br>
amount: 10 digits (pennies)<br>
payment_date: date payment should occur on (datetime.date type class)<br>
"""<br>
------------------------------<u></u>------------------------------<u></u>--------<br>
<br>
<br>
The question: what would this look like with type annotations? As a point of interest, the last parameter, payment_date, can be /anything/ that quacks like a datetime.date -- I tend to use my own dbf.Date class, which subclasses object, not datetime.date itself.<br>
<br>
--<br>
~Ethan~<div class="HOEnZb"><div class="h5"><br>
______________________________<u></u>_________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org" target="_blank">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" target="_blank">https://mail.python.org/<u></u>mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" target="_blank">http://python.org/psf/<u></u>codeofconduct/</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Ryan<div><div>If anybody ever asks me why I prefer C++ to C, my answer will be simple: "It's becauseslejfp23(@#Q*(E*EIdc-SEGFAULT. Wait, I don't think that was nul-terminated."</div>
</div><div><br></div></div>
</div>