Re: [unrev-II] Evaluation of Python

From: Eric Armstrong (eric.armstrong@eng.sun.com)
Date: Sat Mar 25 2000 - 17:18:40 PST

  • Next message: Eric Armstrong: "[unrev-II] Evaluation of Ruby"

    From: Eric Armstrong <eric.armstrong@eng.sun.com>

    Markus Fleck wrote:

    > From: Markus Fleck <fleck+unrev-ii@gnu.org>
    >
    > Eric Armstrong:
    > > --Any non-zero integer == true, like C
    > > (-) Ugh. Too many hours wasted on debugging to
    > > find that you coded a=b instead of a==b, like
    > > you intended. This one is a time-sink.
    >
    > Hmmm... but Python expressions can't have such side effects (like C's
    > "if (a=b)"). I really wouldn't consider the zero==false paradigm a
    > misfeature...

    So you're saying that if a==2 and b==3, then the statement
        if (a=b)
    *won't* assign 3 to a and return true, but will instead return false?

    If so, I withdraw my objection and praise the developers.

    > > --No labeled break/continue
    > > (-) When you have nested loops, you need the
    > > ability to determine which one you are breaking
    > > or continuing.
    >
    > I would argue that there might be better ways to structure control
    > flow than multi-level loop breaks.

    It comes up any time you are processing a multi-dimensional structure.
    It might be a table, for example, or a set of customer records
    containing
    a set of orders which contain a set of ordered items.
    For example:
        for row in table_rows
              for cell in row_cells
                     if (test1) go_to_next_row (continue inner loop)
                     if (test2) stop (break outer loop)
         ...
         do_more_processing

    For a two-dimensional structure, I can put the outer loop in an
    independent function, and finese the problem that way. But that
    requires an extra function that may not be needed for any other
    reason. More importantly, the solution doesn't scale to 3
    dimensions. You wind up having to pass back flags that tell the
    calling routine whether to continue or terminate.

    Is there some other solution I haven't seen?

    ------------------------------------------------------------------------
    DON'T HATE YOUR RATE!
    Get a NextCard Visa, in 30 seconds! Get rates as low as
    0.0% Intro or 9.9% Fixed APR and no hidden fees.
    Apply NOW!
    http://click.egroups.com/1/2120/3/_/444287/_/954033517/
    ------------------------------------------------------------------------

    Community email addresses:
      Post message: unrev-II@onelist.com
      Subscribe: unrev-II-subscribe@onelist.com
      Unsubscribe: unrev-II-unsubscribe@onelist.com
      List owner: unrev-II-owner@onelist.com

    Shortcut URL to this page:
      http://www.onelist.com/community/unrev-II



    This archive was generated by hypermail 2b29 : Sat Mar 25 2000 - 17:25:48 PST