getting rid of pass

Discussion in 'Python' started by David Murmann, May 13, 2006.

  1. Hi all!

    i just had this crazy idea:

    instead of

    while cond():
    pass

    write

    while cond().

    or

    try:
    import xyz
    except ImportError:
    pass

    compared to

    try:
    import xyz
    except ImportError.

    i don't know whether this is syntactically unambiguous or replaces all
    uses of pass, but i find it quite nice to read.

    also if something like this has been proposed before and rejected, i
    apologize for this late-in-the-night idea.

    what do you people think?


    have a nice day, David.
     
    David Murmann, May 13, 2006
    #1
    1. Advertising

  2. David Murmann

    John Machin Guest

    On 13/05/2006 11:40 AM, David Murmann wrote:
    > Hi all!
    >
    > i just had this crazy idea:


    You said it.

    > late-in-the-night idea.


    You said it again.

    >
    > what do you people think?


    I agree with you.
     
    John Machin, May 13, 2006
    #2
    1. Advertising

  3. David Murmann

    Terry Reedy Guest

    "David Murmann" <> wrote in message
    news:...
    > i just had this crazy idea:


    Agreed ;-)

    > instead of
    > while cond():
    > pass
    > write
    > while cond().


    Viewing statememts as functions of the program state, pass is the identity
    function/statement. Many languages have the equivalent. Being explicit is
    Python's style. Getting rid of it would gratuitously break code for no
    reason other than your esthetic preference.

    > i don't know whether this is syntactically unambiguous or replaces all
    > uses of pass, but i find it quite nice to read.


    while x/3.

    would become somewhat ambiguous.

    Terry Jan Reedy
     
    Terry Reedy, May 13, 2006
    #3
  4. David Murmann a écrit :
    > Hi all!
    >
    > i just had this crazy idea:
    >
    > instead of
    >
    > while cond():
    > pass
    >
    > write
    >
    > while cond().


    Yuck

    > or
    >
    > try:
    > import xyz
    > except ImportError:
    > pass
    >
    > compared to
    >
    > try:
    > import xyz
    > except ImportError.


    Yuck again

    > i don't know whether this is syntactically unambiguous or replaces all
    > uses of pass, but i find it quite nice to read.


    I don't. I find it highly unreadable. I really find the pass statement
    to be a great idea, and to highly improve readability.

    > also if something like this has been proposed before and rejected, i
    > apologize for this late-in-the-night idea.
    >
    > what do you people think?


    Please don't feel offended, but I think it would be a very bad thing to do.
     
    Bruno Desthuilliers, May 13, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. damonf
    Replies:
    2
    Views:
    2,475
    damonf
    Nov 8, 2003
  2. dario

    getting rid of params in url

    dario, Feb 20, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    320
    dario
    Feb 20, 2004
  3. Daniel Michaeloff

    Getting rid of session cookie ("ASP.NET_SessionId")

    Daniel Michaeloff, Dec 8, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    9,667
    Hans Kesting
    Dec 9, 2004
  4. Replies:
    5
    Views:
    11,099
    I82Much
    Jun 3, 2009
  5. fitwell
    Replies:
    2
    Views:
    527
    fitwell
    Oct 20, 2003
Loading...

Share This Page