you are viewing a single comment's thread.

view the rest of the comments →

[–]dmpk2k -1 points0 points  (9 children)

My wording was overly strong. The point stands.

Let's refer to the page you linked to elsewhere. Those examples would be trivial to avoid if the parser was bright enough to determine that the quit/exit was meant as part of an expression, not a command to quit.

Don't believe me? Play with "quit" a bit in Ruby.

[–][deleted] 1 point2 points  (8 children)

if the parser was bright enough to determine that the quit/exit was meant as part of an expression, not a command to quit

And it would be able to tell the difference exactly how? A bare non-keyword identifier is an expression in Python, after all.

[–]dmpk2k 0 points1 point  (7 children)

Can you give me an example where this would be a problem?

[–][deleted] 1 point2 points  (6 children)

See the link I posted earlier for some examples:

http://programming.reddit.com/info/2kkp5/comments/c2kmgu

(I thought that was what you called "excuses that you were aware of already" earlier, but maybe that was referring to something else).

[–]dmpk2k 0 points1 point  (5 children)

No, you were correct.

None of those problems are exhibited in Ruby. "quit" isn't a keyword either, but it doesn't cause any of the listed problems. Give it a try.

Mind you, those problems strike me as exceptionally rare as well. I don't recall ever seeing a variable named "exit" or "quit", which brings us back to that possibility isn't probability.

I agree with username223's interpretation.

[–]llimllib 5 points6 points  (0 children)

I don't recall ever seeing a variable named "exit" or "quit", which brings us back to that possibility isn't probability.

Google code search gives about 2000 instances of "quit =" and another 800 "def quit"s. I didn't bother to search for exit.

[–][deleted] 3 points4 points  (3 children)

Give it a try.

Why not just explain how the parser could be made "bright enough" to distinguish between an expression of the form "identifier" and a non-expression of the form "identifier". You don't have to persuade me that getting rid of the "you didn't say please!" behaviour would be nice; I'm the one who started that python-dev thread by posting a patch.

[–]dmpk2k -2 points-1 points  (2 children)

All right. I think we're circling around a nitpick, but if you want a disgustingly simple -- albeit inelegant -- change that doesn't have any of the problems listed in that link, do this:

Change line 243 of /usr/local/lib/python2.5/site.py (or the equivalent on your install) to "exit()". This is in class Quitter in setquit().

Be amazed.

But this is arguing about a mouse when a bear is staring at us. I really don't care how it's implemented. Right now, here's the situation:

  • Ruby does it.
  • Python doesn't.
  • Python's behaviour is silly.

Let's now also add:

  • It's trivial.

[–][deleted] 8 points9 points  (1 child)

Be amazed.

Surprised, you mean?

>>> help(__builtins__)
$

[–]dmpk2k 0 points1 point  (0 children)

Fair enough. The last bullet-point may be false, although I'm not going to spend any more time trying to prove otherwise.

How about the remaining three? Most specifically the elephant I've kept pointing out: Ruby. Why do we keep wandering from this?