Antoon Pardon wrote:

I now have the following question for people who argue that "if x"
is more polymorphic. I could subclass list, so that instances
of this new sequence would always behave as true, even if they are
empty.  I could then rewrite my loop as follows:

while 1:
  extra = produce()
  if not extra:
    break
  for el in extra:
    adjust_with(el)
  calculate()

Is this second loop now more polymorphic as the first?

It's more confusing since you've changed the standard behavior of a standard type, which doesn't really have anything to do with polymorphism. It's more confusing, if that's a benefit.

--
Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/
 San Jose, CA, USA && 37 18 N 121 57 W && AIM, Y!M erikmaxfrancis
  In a cosmic setting, vast and old, beyond ordinary human
   understanding, we are a little lonely. -- Carl Sagan, 1934-1996
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to