New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to use formatting options on the output printed by ic
?
#143
Comments
You can make a custom function which takes any number of argument and then these argument would use the format function to separate the large INT value, then append the modified args list as to print it later on using IC. Define a custom output function to format large integers with separatorsdef custom_output(*args, **kwargs): Set the custom output functionic.configureOutput(prefix='IC| ', outputFunction=custom_output) Test the custom output functionic(123456789) # This will output the formatted large integer with separators |
Thanks for the comment. I see how this works / can work, but honestly this feels like a bit much ceremony to get this done - in this case, it is faster to use print with f-strings. I wonder if there would be a simple way to directly forward simple formatting instructions instead, that would be much lighter to use :) . |
This can be used with icecream by creating a custom argToString function:
Note that this will only work for Python >=3.10 ! |
I would like to apply some formatting outputs to what is printed by ic.
For example, I like to print large int numbers using separators (some other people may want to apply another kind of formatting, for examples, scientific notation formatting or similar, so a general solution would be welcome):
prints something like:
now if I have an
ic
command, I would like to be able to do something like:or (reproducing only the last line):
or something like this.
Is there any simple / easy way to do so? If not, is this something that could be implementable? :)
The text was updated successfully, but these errors were encountered: