Printf for complex numbers
Currently, @sprintf "%.2f" (1+2im) errors, but it would make sense for it to produce "1.00 + 2.00im" I think. Currently, printfing a complex number is not really convenient, requiring a manual split into real + complex, and keeping the format string in sync between them.
https://github.com/JuliaLang/julia/issues/346 for previous discussion
Maybe after 13 years the perception changed... :)
I had a bunch of objections written up but gbaraldi's link (a triple-digit issue -- wow!) already addresses all of them. In particular, once we do Complex, should we also support formatted printing Tuple, Array, Rational, etc? I don't see where it ends.
printf just doesn't feel like the tool for the job. It already has an interface that is largely shared across many (most?) languages and we aren't doing anyone any favors by punning it for every type we can imagine.
I think a more durable solution would be to add a Printf.Format argument to show/print methods that can be applied to individual entries.
In particular, once we do Complex, should we also support formatted printing Tuple, Array, Rational, etc? I don't see where it ends.
I personally have all numbers in mind, and fail to see the connection to containers like tuple or arrays. They are quite a different beast.