Russ P. wrote:

Oh, Lordy. I understand perfectly well how boolean tests, __len__, and
__nonzero__ work in Python. It's very basic stuff. You can quit
patronizing me (and Carl too, I'm sure).

You suggested a syntax for testing non-emptiness (`x is not empty`) which indicated a profound misunderstanding of what the `is` operator does.

You then acknowledged that there might be a problem because of the implication if the `is` operator and weren't sure whether it would work or not:

| But I guess that could only work if there were only one empty list
| that represents all empty lists (as there is only one actual "None").
| I don't know if that makes sense or not.

This ends with you still sounding confused about what the operator does, because that can't make sense if you take into account the meaning of the `is` operator (surely not all empty lists are the same object) and polymorphism (not all empty containers are empty lists).

Hey, everybody goofs. But pointing figures here doesn't help, since it's not unreasonable to assume that someone who says something clearly misunderstanding a feature of the language, and followups to responses _continuing to be confused about it_, is, in fact, confused. The only reason anyone thought you were confused was by your bizarre suggestion about the `empty` syntax and then your confused responses afterwards.

Maybe chalk it up to experience and move on?

The point that you seem to be missing, or refuse to acknowledge for
some reason, is that  "if x" can be mistakenly applied to any object
when the programmer thinks that x is a list -- and the programmer will
receive no feedback on the error.

I have made errors like that, and I could have saved some time had I
used an "empty" method that only applies to a list or other sequence.

Well, that's what you get when you use a dynamic language. There are times when `x + y` doesn't mean numeric addition, or in fact anything like it. Or `x % y` where it _really_ doesn't mean anything like the modulus operator. In dynamic languages, the effect of operations depend on their types. There's really no way around that, and Boolean testing if an object as in `if x: ...` is no different. It means different things depending on what `x` is.

--
Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/
 San Jose, CA, USA && 37 18 N 121 57 W && AIM, Y!M erikmaxfrancis
  The actor is not quite a human being -- but then, who is?
   -- George Sanders
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to