On Jul 30, 3:53 am, "Russ P." <[EMAIL PROTECTED]> wrote:
> Fair enough. I have no dog in this particular fight. I just think it
> wouldn't hurt to add an "isempty()" or "isnonempty()" method to the
> list type, and let people use it if they wish, or continue using "if
> x" if that's what they prefer.

Go right on ahead.  You could implement it like this:

class superenhancedlist(list):
    def isempty(self):
        return not self

>>> a = superenhancedlist()
>>> a.isempty()
True
>>> a.append(1)
>>> a.isempty()
False

Amazingly useful!  Go ahead and use that in all your code.  Anyone
else who comes along and looks at it or tries to maintain it will
really love you for it.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to