Simple exercise

MRAB python at mrabarnett.plus.com
Mon Mar 14 11:57:42 EDT 2016


On 2016-03-14 15:22, Rick Johnson wrote:
> On Monday, March 14, 2016 at 9:19:04 AM UTC-5, alister wrote:
>> A code smell does not necessarily mean the code is wrong,
>> just that it warrants investigation as there is a strong
>> possibility it may be sub- optimal
>
> Yes, technically speaking, you're correct.
>
> But the concept of "code smell" has become something of a
> scarlet letter within the programming community. Once you
> apply it to someone's code, the stigma becomes very
> difficult to rub off -- and not just the "external" stigma
> you feel radiating from scornful stares of your peers, but
> the "self-imposed" stigma as well. It has become a
> derogatory term, and sadly, one that is thrown around much
> too carelessly.
>
> Sure, there are legitimate instances where the term should
> be applied, but in the case of "zip vs explicit sequence
> indexing", the usage of this term could influence a "less
> experienced Python programmer", to adopt a very dangerous
> habit *SIMPLY* because he does not want to be labeled a "bad
> programmer". But the irony is, he may produce worse code by
> blindly reaching for his "sequence zipper"!
>
> The zip function is not something you should get in the
> habit of using without first considering the consequences of
> *EACH SPECIFIC USE-CASE*. Yes, it can be helpful at times,
> and yes, it can make code easier to read. But it can also
> create subtle bugs. Personally, i choose to avoid it, but
> others should make the decision for themselves.
>
> In a nutshell, the zip function is both "elegantly powerful"
> and "cunningly destructive". So buyer beware. Because,
> Python.org ain't no Walmart folks, and they sure as hell
> don't give refunds for sequence members that evaporated into
> the ether, after you adopted the bad habit of using zip,
> simply because -> "Mark said so"!
>
In other words, code is like cheese. Some of it smells, even when 
there's nothing wrong. :-)




More information about the Python-list mailing list