May-06-2019, 08:57 AM
(May-06-2019, 06:42 AM)Skaperen Wrote: i think that would either end up with a lot of extra code, or a more twisty maze of function callsI don't know your code, so you should know better and I just speculate, but the whole point of singledispatch is to have same function call and it will be different function depending on first argument type.
(May-06-2019, 06:42 AM)Skaperen Wrote: it's just a difference in how i shift the decimal point around when there is a whole value there during conversion to string. about 80 lines of code does the same thing for (int,float,Decimal). it's complex when .imag is non-zero and Fraction that will be my future mess.
Again, I can just speculate, but I think it's mess exactly because you try to keep everything in one function and thus use a lot of if statements depending on type. I think, even with some repeating parts, that you cannot put in a separate function to avoid repeting, it will be easier and you will end up with more readable and structured code to deal if for each type you have different function and it's strightforward
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs