(Jan-13-2024, 09:30 PM)sgrey Wrote: what is your actual use case? Do you need to print out elements of lists/tuples of arbitrary length or do you always have only 2 elements?Always 2 elements followed by newline.
Quote:Depending on what you are writing, you can just use format string like print(f"{idx[0]}\t{idx[1]}\n")
I'm just trying to assemble the string here, not print it. How to do that with f
?My terms are just
str(idx)
and choice
, with a trailing newline. Quote:you can define your own __str__
method in a data class.
I'd like to learn how, but sounds even more complicated.