Closed pylint-bot closed 8 years ago
Original comment by Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore?):
Hi,
Could you post the issue on pylint's tracker, please? https://bitbucket.org/logilab/pylint/ This issue tracker is for pylint's underlying AST and inference engine.
Originally reported by: Anonymous
I have a line where I have a list of tuples and one of the elements of the tuple is an object which has a str conversion function. I think the most trenchant code for printing this for inspection is
"\n".join([",".join(map(str,e)) for e in list_of_tuples])
because join wants its list to consist of strings.
Using a list comprehension for this would probably look like
"\n".join([",".join([str(ee) for ee in e]) for e in list_of_tuples])
But I haven't tried it because it's not economical compared to map.
I know I can disable bad built-in on the basis of an individual built-in. But bad-builtin is relevant for other choices between LC and map so I'm looking for something more subtle. I'm not opposed to LC's in general. As a newbie who has been exposed to FP I appreciate collection comprehensions and am delighted to use them. But map(str) should be considered a good idiom. If you set the criterion as allow builtins that transform a collection to the same collection maybe this is a worthwhile relaxation of the bad-builtin criteria