Refactoring python code. Extracting variables and other.

Pycon2016 talk by Brett Slatkin Example 1: Extract variable import random month = random.choice(MONTHS) if (month.lower().endswith('r') or month.lower().endswith('ary')): print('%s is a good time to eat oysters' % month) elif 8 > MONTHS.index(month) > 4: print('%s is a good time to eat tomatoes' % month) else: print('%s is a good time to eat asparagus' % month) Becomes: class OystersGood: def __init__(self, month): month = month month_lowered = month.lower() self.ends_in_r = month_lowered.endswith('r') self....

October 8, 2016 · SergeM

Useful python links

Books Test-Driven Development with Python Harry Percival Python Testing with unittest, nose, pytest : eBook Testing Python: Applying Unit Testing, TDD, BDD and Acceptance Testing link . Videos Outside-In TDD Harry Percival, PyCon 2016 Докеризация веб приложения на Python, Антон Егоров Thinking about Concurrency, Raymond Hettinger, Python core developer Tutorials Разработка идеального pypi пакета с поддержкой разных версий python (Rus), 2020....

October 8, 2016 · SergeM