Steven D'Aprano wrote:
which is irony extreme since 'not' is typically considered a logical
>  operator.
Because "not" is typically used as a logical operator.

In English, it negates a word or statement:

"the cat is not on the mat" -->  "the cat is on the mat" is false.

Your pedantic bogus cat analogy talks past my point entirely, as well as making you look silly... if you would stop being pedantic long enough to think about what I'm saying you might come to some understanding...

... yes, 'not' is a logical negation. Why would you waste time with a pedantic explanation of 'not' ? Wait--- its a rhetorical question...


Why should the negation of a list imply that the list empty? ... nor any other abstract condition which is not well suited to 'not' ? (forget python for a moment... then move on to my argument...)

What made the python development team (or individual) decide that the logical construct 'not list' would return True if the list is empty? To say that "This is the way we do it in Python because Python does it this way"--- goes beyond pedantic becoming circular and redundant.

On the other hand, if you were to tell me *why* you think that the logical construct 'not list' should be logically True when the list is empty--- when clearly negating a list would not necessarily mean to make the list empty (including destroying it)... then you might be seeing my point.

   Here's the bottom line you missed...

... although syntactically correct, the following test is not a logical construct that makes sense (except for the syntactically initiated):

    if not list      <=====  this makes no logical sense...

    ... to test for an empty list . . .

    ... although, it is legal syntax.   :-}


I know that is the way Python does it... I've been coding it that way for a long time... but that doesn't answer my concern....


   To say this another way, IMHO,

        if not list


... should return True only if 'list' is bound to NULL, or if the name 'list' would throw a name exception...

... and, Python should have an explicit way of testing for an empty list that is clear, concise, and easy to understand even for the relatively new Python programmer. This is not intended to generate counter argument, its just my feedback on a language construct that I find to be inconsistent logically. ... Please, no pedantic discourse explaining why I'm wrong... just put in into a PEP and move on. :)





kind regards,
m harris




--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to