L
Lawrence D'Oliveiro
How exactly would you make s = s.replace('"',""") faster than
*not* doing the replacement?
Wrong answer. Correctness comes first, then we worry about efficiency.
How exactly would you make s = s.replace('"',""") faster than
*not* doing the replacement?
Gabriel G said:FWIW, a *lot* of unit tests on *my* generated html code would break...
Lawrence said:I don't have to be. Whoever the designer was, they had not properly thought
through the uses of this function. That's quite obvious already, to anybody
who works with HTML a lot. So the function is broken and needs to be fixed.
If you're worried about changing the semantics of a function that keeps the
same "cgi.escape" name, then fine. We delete the existing function and add
a new, properly-designed one. _That_ will be a wake-up call to all the
users of the existing function to fix their code.
Lawrence said:I'm not surprised. Disappointed, yes. Verging on disgust at some comments in
this thread, yes. But "surprised" is what a lot of users of the existing
cgi.escape function are going to be when they discover their code isn't
doing what they thought it was.
Why should they be surprised? The documentation states clearly what
cgi.escape() does (as does the docstring).
What about the users who don't need to "fix" their code since it's working
fine and flawlessly with the current cgi.escape?
Why did you write your code that way?
I generally find that Fredrik's rudeness quotient is satisfactorily
biased towards discouraging ill-informed comment.
As far as rudeness goes, I've found your approach to this discussion
to be pretty obnoxious, and I'm generally know as someone with a
high tolerance for idiotic behaviour.
Lawrence said:Documentation frequently states stupid things. Doesn't mean it should be
treated as sacrosanct.
I have code that checks to see if my CGI scripts generate the pagesJon said:You're right - I've never seen anyone do such a thing. It sounds like
a highly dubious and very fragile sort of test to me, of very limited
use.
That's not the point. The point is that someone using cgi.escape() will
hardly be surprised of what it does and doesn't do.
Jon said:It's a pity he's being rude when presented with well-informed comment
then.
Why do you say that? I have confined myself to simple logical
arguments, and been frankly very restrained when presented with
rudeness and misunderstanding from other thread participants.
In what way should I have modified my postings?
Jon Ribbens said:You're right - I've never seen anyone do such a thing. It sounds like
a highly dubious and very fragile sort of test to me, of very limited
use.
So what sort of test would you use, that doesn't involve comparing
actual output against expected output?
Please allow me to apologise. I have clearly been confusing you with
someone else. A review of your contributions to the thread confirms your
asertion.
Jon said:This has nothing to do with character encodings.
Lawrence said:And this surprise, or lack of it, is relevant to the argument how, exactly?
Lawrence said:What you're doing is adding to the reasons why the existing cgi.escape
function is stupidly designed and implemented. The True case is by far the
most common
Lawrence said:And this surprise, or lack of it, is relevant to the argument how, exactly?
Georg said:It says "to HTML-safe sequences". That's reasonably clear without the need
to reproduce the exact replacements for each character.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.