On Jan 29, 2008 2:44 PM, Talin firstname.lastname@example.org wrote:
The problem I see with this is, what if you need to use both decimals and floats together?
If you need decimals and floats together, then you'd need to pick one and convert the other, eg: from decimal typedef Decimal as float ofloat = __builtins__.float mydecimals = [1.00000000000000000000001, ..., 99.000000000000000009] myfloat = ofloat("3.14")
If for some reason you need exactly even quantities of decimals and floats then at least you're no worse off than you are now -- just don't typedef.
And if you really are suffering repetitive strain injury from having to type 'OrderedDict' 100 times in your code, it seems to me that you could just avoid creating each one individually, and instead have an array of inputs which gets converted to an array of OrderedDict. In other words, one generally doesn't see code where the same repeated item is assigned to 100 individual variables; Most programmers, when they see more than half a dozen similar items, will start thinking about ways in which they can roll up the definitions into an algorithm to generate them.
But it gets back to the prettiness* factor - it's prettier to read a mapping of keys to values that's written like a dict than it is to read a list of 2-tuples, and at least some of the time it's much nicer to have such a mapping in the sourcefile than converting a datafile.
-T. (*eye of the beholder blah blah blah ;-)