Removing None objects from a sequence

Steven D'Aprano steve at
Mon Dec 15 04:21:21 CET 2008

On Mon, 15 Dec 2008 02:11:10 +0000, Lie Ryan wrote:

>> So given the normal precedence rules of Python, there is no ambiguity.
>> True, you have to learn the rules, but that's no hardship.
> *I* know about the precedence rule, but a newbie or a tired programmer
> might not. He might want to reverse the truth value of argument b but
> instead has just reversed the whole expression.

And? A newbie or a tired programmer might not know that a^b is bit-wise 
xor instead of exponentiation, or that range(n) doesn't include n, or 
even that len(alist) returns the length of a list. There's no limit to 
the potential mistakes that are possible for a programmer who is tired, 
inexperienced, intoxicated or just plain stupid enough. What's your 
point? Are you expecting Python to be mistake-proof?

There's a certain level of knowledge about the language necessary to 
program effectively, and learning that "is not" is a single operator is 
not particularly onerous.


More information about the Python-list mailing list