wish list for python

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jim Newton

    wish list for python

    does anyone know where i can find the current wish-list or to-do list
    for futer python releases?

    Does anyone know if there is a play to allow non-evaluatable statements
    to return values? I'm only a week to this language so far but it
    seems very strange to me (coming from a list background) that i cannot
    somehow say
    x = if a:
    then b
    else c

    or

    x = for i in some-sequence:
    blah blah blah.


    and what about something like the following?

    x = cond:
    a > 1:
    0
    a > 10:
    1
    a > 100:
    2
    True:
    -1


    ????
    -jim

  • Andrew Bennetts

    #2
    Re: wish list for python

    On Fri, Oct 24, 2003 at 06:47:27AM +0200, Jim Newton wrote:[color=blue]
    > does anyone know where i can find the current wish-list or to-do list
    > for futer python releases?[/color]

    Python Enhancement Proposals:

    This PEP contains the index of all Python Enhancement Proposals, known as PEPs. PEP numbers are assigned by the PEP editors, and once assigned are never changed. The version control history of the PEP texts represent their historical record.


    and the SourceForge bug/patch trackers:




    And failing all else, try searching the comp.lang.pytho n archives :)
    [color=blue]
    > Does anyone know if there is a play to allow non-evaluatable statements
    > to return values? I'm only a week to this language so far but it
    > seems very strange to me (coming from a list background) that i cannot
    > somehow say
    > x = if a:
    > then b
    > else c[/color]

    For this particular expression, see PEP 308 (which has been rejected).
    [color=blue]
    > x = for i in some-sequence:
    > blah blah blah.[/color]

    I'm not sure what this is meant to mean, but I suspect PEP 289 would provide
    what you're after.
    [color=blue]
    > and what about something like the following?
    >
    > x = cond:
    > a > 1:
    > 0
    > a > 10:
    > 1
    > a > 100:
    > 2
    > True:
    > -1[/color]

    See the second proposed solution in PEP 275, which is still listed as "Open"
    -- but Guido doesn't seem keen on the idea:
    The official home of the Python Programming Language


    Besides, this particular example is probably better written as:
    try:
    x = int(math.log10( a))
    except (OverflowError, ValueError):
    x = -1

    -Andrew.


    Comment

    • Emile van Sebille

      #3
      Re: wish list for python


      "Jim Newton" <jimka@rdrop.co m> wrote in message
      news:3F98AEDF.4 020505@rdrop.co m...[color=blue]
      > does anyone know where i can find the current wish-list or to-do list
      > for futer python releases?
      >[/color]

      This PEP contains the index of all Python Enhancement Proposals, known as PEPs. PEP numbers are assigned by the PEP editors, and once assigned are never changed. The version control history of the PEP texts represent their historical record.

      [color=blue]
      > Does anyone know if there is a play to allow non-evaluatable statements
      > to return values?[/color]



      HTH,

      Emile van Sebille
      emile@fenx.com


      Comment

      • David Eppstein

        #4
        Re: wish list for python

        In article <3F98AEDF.40205 05@rdrop.com>, Jim Newton <jimka@rdrop.co m>
        wrote:
        [color=blue]
        > does anyone know where i can find the current wish-list or to-do list
        > for futer python releases?[/color]

        This PEP contains the index of all Python Enhancement Proposals, known as PEPs. PEP numbers are assigned by the PEP editors, and once assigned are never changed. The version control history of the PEP texts represent their historical record.


        --
        David Eppstein http://www.ics.uci.edu/~eppstein/
        Univ. of California, Irvine, School of Information & Computer Science

        Comment

        • Dave Kuhlman

          #5
          Re: wish list for python

          Jim Newton wrote:

          [snip]
          [color=blue]
          > x = for i in some-sequence:
          > blah blah blah.[/color]

          Python has "list comprehensions" for this. Consider:
          [color=blue][color=green][color=darkred]
          >>> a = [-1,1,-2,2,-3,3]
          >>> a[/color][/color][/color]
          [-1, 1, -2, 2, -3, 3][color=blue][color=green][color=darkred]
          >>> [x for x in a if x > 0][/color][/color][/color]
          [1, 2, 3][color=blue][color=green][color=darkred]
          >>> def f(x):[/color][/color][/color]
          ... return x * 3
          ...[color=blue][color=green][color=darkred]
          >>> [f(x) for x in a if x > 0][/color][/color][/color]
          [3, 6, 9][color=blue][color=green][color=darkred]
          >>>[/color][/color][/color]

          For more info see: ... Well, I searched but could not find any
          documentation on list comprehensions. I suppose that's the
          problem with putting every feature anyone asks for into a
          language.

          At one time, we had a nice, understandable language that even I
          could learn. Sigh.

          "I used to love her"

          I used to wake up each morning, get my breakfast in bed.
          When I had some worries she would ease my aching head.
          Now she runs around, with every man in town.
          Still trying to take me for that same old clown.
          Because I used to love her. But, it's all over now.

          -- The Animals

          Adde parvum parvo magnus acervus erit.
          [Add little to little and there will be a big pile.]

          -- Ovid, quoted from "The mythical man-month", Frederick Brooks,
          Chapter 5, "The second-system effect"

          I admit it. I'm a little grouchy this morning. My work on this
          parser thing is not going so well.

          OK. One more search and I found some documentation -- See Tutorial,
          "5.1.4 List Comprehensions" :



          Dave

          [snap, err, I mean snip]

          --
          Dave Kuhlman

          dkuhlman@rexx.c om

          Comment

          • David

            #6
            Re: wish list for python

            Con fecha Fri, 24 Oct 2003 06:47:27 +0200
            Jim Newton <jimka@rdrop.co m> escribió:
            [color=blue]
            > does anyone know where i can find the current wish-list or to-do list
            > for futer python releases?
            >
            > Does anyone know if there is a play to allow non-evaluatable
            > statements to return values? I'm only a week to this language so
            > far but it seems very strange to me (coming from a list background)
            > that i cannot somehow say
            > x = if a:
            > then b
            > else c
            >
            > or
            >
            > x = for i in some-sequence:
            > blah blah blah.
            >
            >
            > and what about something like the following?
            >
            > x = cond:
            > a > 1:
            > 0
            > a > 10:
            > 1
            > a > 100:
            > 2
            > True:
            > -1
            > [/color]

            Try Ruby! ;-)


            Comment

            • Skip Montanaro

              #7
              Re: wish list for python

              [color=blue]
              > x = cond:
              > a > 1:
              > 0
              > a > 10:
              > 1
              > a > 100:
              > 2
              > True:
              > -1[/color]

              PEP 275:

              This PEP proposes strategies to enhance Python’s performance with respect to handling switching on a single variable having one of multiple possible values.


              Skip

              Comment

              • python newbie

                #8
                Re: wish list for python

                >I admit it. I'm a little grouchy this morning. My work on this[color=blue]
                >parser thing is not going so well.[/color]

                "Work performed with attachment is a shackle, whereas work performed
                with detachment does not affect the doer. He is, even while working, in
                solitude."
                -Maharshi


                Comment

                Working...