davecom/ClassicComputerScienceProblemsInPython

You could use generator expression

Closed this issue · 3 comments

Hello there,
Python str.join method accepts any kind of iterable object so, you could use a generator expression here. However, it is not a big different.

output += "".join([c.value for c in row]) + "\n"

        output += "".join(c.value for c in row) + "\n" 

Hi @GreatBahram,
You're absolutely right, thanks for the suggestion and this would be better. If we do another edition of the book, I will make the change. Because it would make this source code repository diverge from the code from the physical book for a non-error, though, I won't make the change at this time.
Best,
Dave

@davecom, You should create a branch or a fork that includes all enhancements. The master branch of this repository will be untouched and everybody has the option to use the enhanced version.

@m-entrup That's a good idea. I may do that in a branch in the future. Thanks!