Skip to content

You could use generator expression #8

Closed

Description

@GreatBahram

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" 

Activity

  1. davecom commented on Jul 26, 2019

    @davecom
    Owner

    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

  2. m-entrup commented on Aug 7, 2019

    @m-entrup

    @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.

  3. davecom commented on Aug 7, 2019

    @davecom
    Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions