[issue13364] Duplicated code in decimal module

2011-11-08 Thread Mark Dickinson
Mark Dickinson added the comment: Sorry, I'm closing this as rejected. It might possibly have been better to write the code this way to begin with, but the code is already there, it's working, and there's little to be gained by 'fixing' it at this point. -- assignee: -> mark.dickins

[issue13364] Duplicated code in decimal module

2011-11-07 Thread Éric Araujo
Éric Araujo added the comment: Thanks for the report. If I may offer recommendations about submitting bugs: - Know that stable branches don’t get code cleanups, only bug fixes, so you have to target 3.3 - Focused bugs (“code duplication in packaging commands”) are much better that over-broad

[issue13364] Duplicated Code

2011-11-07 Thread skreft
skreft added the comment: One possible refactor would be. import operator def logical_or(self, other, context=None): return self._logical_op(other, operator.__or__, context) def logical_xor(self, other, context=None): return self._logical_op(other, operator.__xor__, contex

[issue13364] Duplicated Code

2011-11-06 Thread Mark Dickinson
Mark Dickinson added the comment: How would you suggest refactoring this? For that example, I'd prefer not to remove the repetition; as it is, the code is clean and clear. Eliminating the repetition would involve adding an extra layer of indirection, making the code in one of these function

[issue13364] Duplicated Code

2011-11-06 Thread skreft
New submission from skreft : By using tools like clonedigger is possible to spot some repeated code. One file that caught my attention is Lib/decimal.py. It has many portions of duplicated code. Here is an example: def logical_or(self, other, context=None): """Applies an 'or' operation