Removing None objects from a sequence

Lie Ryan lie.1296 at gmail.com
Mon Dec 15 06:39:45 CET 2008


On Mon, 15 Dec 2008 03:21:21 +0000, Steven D'Aprano wrote:

> 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.

I give up. It does not matter to me anyway. I was just expressing the 
preference that operators should be composed of a single word, especially 
since none of the other operators are multi-words (Special cases aren't 
special enough to break the rules). The only advantage of using 'is not' 
over 'isnot' is that we have one less keyword to deal with.




More information about the Python-list mailing list