Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Baroque code in utils.py #3

Open
GoogleCodeExporter opened this issue May 5, 2015 · 0 comments
Open

Baroque code in utils.py #3

GoogleCodeExporter opened this issue May 5, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

utils.py line 111 to end of function:

    column_index = 0
    for column in range(0,sheet.ncols):
        column_item = sheet.cell_value(rowx=0, colx=column)
        column_choice_list.append((column_index, column_item))
        column_index = column_index + 1
    return column_choice_list

First rewrite (better Python idioms):

    for column_index in range(sheet.ncols):
        column_item = sheet.cell_value(rowx=0, colx=column_index)
        column_choice_list.append((column_index, column_item))
    return column_choice_list

Second rewrite (use available concise functionality):

    return enumerate(sheet.row_values(rowx=0))


Original issue reported on code.google.com by sjmac...@lexicon.net on 3 Dec 2009 at 11:15

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

No branches or pull requests

1 participant