Re: Comments merging, pass 2

Steven Armstrong <[email protected]>
Newsgroups gmane.comp.web.pyblosxom.devel
Message-ID <[email protected]>
Bill Mill wrote:
 >
 > I'm glad you took it well, especially since I was wrong on a bunch of
 > it. I knew that would happen - I'm very often wrong when I criticize
 > someone else.
 >

Regarding code I think it would be wrong, sometimes even harmfull, not 
to say anything if you see something strange. Critisizing on code has a 
Q/A effect as one is forced to review and rethink it.

<snip>
> 
> And I hate it in those languages too, so I'm admitting a bias on this
> issue. Especially in python, where it's not even really in the
> language, I don't think it should be used.
> 

Guess I'm just used to doing it that way.
I think it's actually quite a efficient way to code such a conditional 
switch. I tend to use it if I don't want some not-so-important code to 
get into the way and disturb the flow.

I agree that it looks really wierd in Python.

<snip>test impl</snip>
> :!python test.py
> t1: 27.0438070297
> t2: 21.8385300636
> 
> But, realistically, 6 seconds over a million iterations translates
> into a .000006 second difference in execution speed, with integers at
> least. I just wanted to write the test for fun :)
> 
> Whatever's most readable is what should be used, and I don't find the
> and/or version to be more readable; that may just be personal bias.
> 

Do you now how to write such a test regarding memory usage? I was 
thinking about how but wouldn't know where to start.

<snip>
> You are correct, and I am wrong. I was not seeing things clearly
> yesterday afternoon - it all seems really apparent to me now.
> 
> 
>>Have a look at the whole statement.
>>
>># original
>>if len(renderer.getContent()) == 1 \
>>   and renderer.flavour.has_key('comment-story') \
>>   and not entry.has_key("nocomments"):
>>
>># new
>>if len(renderer.getContent()) == 1 \
>>   and renderer.flavour.has_key('comment-story') \
>>   and (config.has_key('comment_trigger') and \
>>     [form.has_key(config.get('comment_trigger'))] or [True])[0] \
>>   and not entry.has_key("nocomments"):
>>
> 
> 
> OK, I see what you're saying now. I still have a vague uneasiness
> about this statement; it seems to be too complicated for its own good.
> But, I can't think of a better way to do it, so I retract any
> objection I had to the logic of it.
> 
> <snip>clear and patient explanation of how I'm wrong</snip>
> 

I didn't write such a detailed explanation to prove you wrong.
After your comment on the code I wasn't sure anymore if I might had 
missed something. The "patient explanation" was actually my analysis of 
the whole thing to make sure that my twisted mind hadn't played any 
tricks on me.

<snip>
> Yeah, I realized this last night, and added an error variable instead
> of changing the comment description. That would really piss me off if
> I did that. Good point about the non-sanitization too, I didn't
> consider funky syntaxes.
> 
> Peace
> Bill Mill
> bill.mill at gmail.com
> 

It actually bit me to, that's how I figured it would be better to leave 
the description allone :-))

cheers
Steven


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.