Re: Case-insensitive string compare?



Le Friday 05 September 2008 08:24:29 Fredrik Lundh, vous avez écrit :
Maric Michaud wrote:
"premature optimization is the root of all evil"

So is use by that statement by people who don't have the slightest idea
about what it actually means.

The full version is

"We should forget about small efficiencies, say about 97% of the time:
premature optimization is the root of all evil."

Note the use of "small efficiencies". That is, in Python, things like
local binding, inlining, slots, lazy generation of short sequences, etc.
That is, things that takes time to write and reduces maintainability.

It's not about having an excuse for writing crappy code with large
inefficienies.

And it's definitely not about programmers intentionally picking a dumb
solution so they can optimize it later.


Yes, I'm aware of that, thanks, but Chris Rebert was proposing to alter the
data structure in order to achieve this simple comparison, I don't think it
fails into your concern.

> If the OP's proposal seems already messy, how about ths one :
> if lib.lower() not in ( e[0] for e in stage_map.items() ) :
> ...


Sorry, should be read :

if lib.lower() not in ( e[0] for e in stage_map.values() ) :

and it was the expression for comparison Chris's solution lead to, not a
proposal.

Given that your solution is just a remarkably inefficient way to write
"lib.lower() not in stage_map", and thus doesn't solve the OP:s problem,
I suspect you're taking the "evil" part of Hoare's dictum a few bits too
literally.


I suspect you are coming to conclusions a bit quickly, without taking the pain
of understanding the whole discussion.

</F>

--
http://mail.python.org/mailman/listinfo/python-list



--
_____________

Maric Michaud
.



Relevant Pages

  • Re: Maine: bastion of civil rights
    ... shorter than others around it, you can REALLY rake in the cash. ... I suspect some city councils and cops are that stupid and evil, ...
    (rec.sport.football.college)
  • Re: Geneva Conventions? Fuck em!!!
    ... >> suitcase nuke from being detonated was to torture a suspect would you ... It is the defacto standard by other nations. ... > I think most people consider that evil. ...
    (rec.boats)
  • Re: did man walk on the moon...and creationism.
    ... can tell us if the suspect was involved in the crimes he is accused ... about the involvement and the guilt of the suspect. ... 2401.jpg> They're evil! ... email to oshea dot j dot j at gmail dot com. ...
    (talk.origins)
  • Re: Geneva Conventions? Fuck em!!!
    ... > suitcase nuke from being detonated was to torture a suspect would you ... I think most people consider that evil. ...
    (rec.boats)