Last active
December 19, 2015 03:58
-
-
Save andy47/5893615 to your computer and use it in GitHub Desktop.
Example code to show refactoring opportunity
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Portfolio(object): | |
... | |
def get_portfolio(self, portfolio_code): | |
... | |
stmt = """SELECT id FROM portfolios WHERE code=?""" | |
cursor.execute(stmt, (portfolio_code,)) | |
portfolio_id = cursor.fetchone()[0] | |
... | |
def add_value(self, portfolio_code, ...): | |
... | |
stmt = """SELECT id FROM portfolios WHERE code=?""" | |
cursor.execute(stmt, (portfolio_code,)) | |
portfolio_id = cursor.fetchone()[0] | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment