[Chicago] FW: Playing with generics

RCRamsdell@gldd.com RCRamsdell at gldd.com
Wed Nov 23 13:10:38 CET 2005



>I forgot to respond to the original.  Anyway, I would agree that it 
>isn't a very good use of generic functions, since it's really a coersion 
>that you are doing, you aren't using different algorithms depending on 
>the arguments.
Yup.  I was really just trying them out.


>Generally using default arguments at the beginning of the signature is a 
>pain.  In this case I don't think it's worth saving the ()'s, and you 
>should always take a tuple of (x, y) as the first argument. 
>Incidentally, you can do:

>def calc((xa, ya), scale):
>    return atan(xa/ya)*scale

>Though it's a little weird looking, and doesn't lead to the best error 
>messages when you get the signature wrong.
For some reason this didn't even occur to me, but it is probably the cleanest way.  I'll probably also lose the scale factor, on the theory that the internal units should be consistent, and scaling should be applied at input/output to human-readable form.

Robert
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/ms-tnef
Size: 2940 bytes
Desc: not available
Url : http://mail.python.org/pipermail/chicago/attachments/20051123/f6bdcdf9/attachment.bin


More information about the Chicago mailing list