For review: PEP 308 - If-then-else expression

Andrew Dalke adalke at
Sun Feb 9 03:33:08 CET 2003

Paul Rubin:
> I just don't understand this line of reasoning.  Let's look at the
> changes that have been introduced in Python in the past release or two:

*sigh*  No, it's just that I can't include a summary of my arguments
in every reply I make.

> - generators / iterators

I like 'em.  I understand 'em.  They replace a construct I had long
used, in a logically equivalent way, but simpify the scaffolding I was
able to write in my sleep

class RecordReader:
  def __init__(self, infile):
    self.infile = infile
    self._n = 0
  def next(self):
     ... parse a record from the input file
     if have_record:
      self._n = self._n + 1
      return record
    return None
  def __getitem__(self, i):
    if i != self._n:
       raise TypeError("forward iteration only")
   x =
   if x is None:
     raise IndexError(i)
   return x

for record in RecordReader(open("input.txt")):

> - change in scheme for method searching for multiple inheritance

No idea what's going on there.  Rarely use MI, so doesn't affect me
that much.

> - metaclasses

No idea what's going on there.  I don't understand Guido's
essay on it.  I don't know when it's needed.  So far it doesn't
seem that I need it.  I hope I can ignore it.

> - string methods

Nice.  Happy, happy, joy, joy.

Needed for unicode.  Stays in the existing framework that "oh,
objects have methods".  Prefer it over module functions.

> Are you really claiming that conditional expressions are harder to
> explain to novices than stuff like metaclasses?

Look, I don't understand metaclasses.  I'm not going to explain
'em, and it appears I don't need to.  And I'm one of the most knowledgeable
software people in this field (IMO and others).

So no, but then, I don't need to.

> I think I was around 12 years old when I first encountered conditional
> expressions in C.  I understood them right away.  There was other
> stuff I didn't understand, but conditional expressions just weren't a
> big deal.
> Really, you're making too much of this.

See my other arguments which show that in the codebase I
analyzed they are misused more than they are used.  And the
authors of the codebase are people in my user base, which
is why it's important to me.

                    dalke at

More information about the Python-list mailing list