Tim Peters writes: > The same applies to string.join(iterable), for that matter. Clark Evans writes: > This code-snippet is littered everwhere in my applications: > > string.join([str(x) for x in iterable]) > > Its tedious and makes code hard to read. Do we need a PEP to fix this? I'm convinced! Of course any code like the following would break: class Item: # ... def __eq__(self, other): "All Items are equal!" return isinstance(other, Item) def process_item(item): """Processes an item, returning a string.""" # ... def process_items(items): """This processes each Item in the list and returns a string containing the entire thing.""" while True: try: return ','.join(items) except TypeError: pos = items.index(Item()) # find first Item items[pos] = process_item( items[pos] ) continue <Big Wink> Seriously, I can't think of a sane use for <String>.join() raising a TypeError, so I'd say run it by Guido and if it doesn't offend his design intuition, let's fix it! -- Michael Chermside
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