Nick Coghlan wrote: > I agree with this point actually. There should be an "iterable" formatting > code that looks something like "%[sep]i" > > Then "%i" % (my_seq,) would be the equivalent of "".join(my_seq), only > allowing it to be easily embedded inside a larger format string. > > Some other examples: > ("% i" % my_seq) => " ".join(my_seq) > ("%, i" % my_seq) => ", ".join(my_seq) > > I see this as being similar to the way that "%.2f" controls the way that a > floating point value is displayed. A correction to this - such a formatting operator would need to automatically invoke str on the items in the iterable: ("%i" % (my_seq,)) => "".join(map(str, my_seq)) ("% i" % (my_seq,)) => " ".join(map(str, my_seq)) ("%, i" % (my_seq,)) => ", ".join(map(str, my_seq)) ("%(seq), i" % dict(seq=my_seq)) => ", ".join(map(str, my_seq)) Cheers, Nick. -- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia --------------------------------------------------------------- http://boredomandlaziness.blogspot.com
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4