Python keywords vs. English grammar

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Roy Smith

    #1

    Python keywords vs. English grammar

    I noticed something interesting today. In C++, you write:

    try {
    throw foo;
    } catch {
    }

    and all three keywords are verbs, so when you describe the code, you can
    use the same English words as in the program source, "You try to execute
    some code, but it throws a foo, which is caught by the handler".

    In Python, you write:

    try:
    raise foo
    except:

    and now you've got a mix of verbs and (I think), a preposition. You can't
    say, "You try to execute some code, but it raises a foo, which is excepted
    by the handler". It just doesn't work grammatically.

    Sigh.
  • Rony Steelandt

    #2
    Re: Python keywords vs. English grammar

    I'm not a english speaker, so I just accepted it...;

    I understood it as :
    'Try' allways to execute this code, 'except' when it doesn't work do
    this....

    [color=blue]
    > I noticed something interesting today. In C++, you write:
    >
    > try {
    > throw foo;
    > } catch {
    > }
    >
    > and all three keywords are verbs, so when you describe the code, you can
    > use the same English words as in the program source, "You try to execute
    > some code, but it throws a foo, which is caught by the handler".
    >
    > In Python, you write:
    >
    > try:
    > raise foo
    > except:
    >
    > and now you've got a mix of verbs and (I think), a preposition. You can't
    > say, "You try to execute some code, but it raises a foo, which is excepted
    > by the handler". It just doesn't work grammatically.
    >
    > Sigh.[/color]


    --
    ---
    Rony Steelandt
    BuCodi
    rony dot steelandt (at) bucodi dot com

    Visit the python blog at http://360.yahoo.com/bucodi


    Comment

    • Duncan Smith

      #3
      Re: Python keywords vs. English grammar

      Roy Smith wrote:[color=blue]
      > I noticed something interesting today. In C++, you write:
      >
      > try {
      > throw foo;
      > } catch {
      > }
      >
      > and all three keywords are verbs, so when you describe the code, you can
      > use the same English words as in the program source, "You try to execute
      > some code, but it throws a foo, which is caught by the handler".
      >
      > In Python, you write:
      >
      > try:
      > raise foo
      > except:
      >
      > and now you've got a mix of verbs and (I think), a preposition. You can't
      > say, "You try to execute some code, but it raises a foo, which is excepted
      > by the handler". It just doesn't work grammatically.
      >
      > Sigh.[/color]

      It does, but it's maybe not 'plain English'.



      Duncan

      Comment

      • John Salerno

        #4
        Re: Python keywords vs. English grammar

        Roy Smith wrote:
        [color=blue]
        > try {
        > throw foo;
        > } catch {
        > }[/color]
        [color=blue]
        > try:
        > raise foo
        > except:[/color]

        But which one is prettier? ;)

        Comment

        • defcon8

          #5
          Re: Python keywords vs. English grammar

          1. Does it matter?
          2. Is it affecting your productivity.
          3. Are you not trying to programme?
          4. It is open source, change it and stop whining.

          Comment

          • bruno at modulix

            #6
            Re: Python keywords vs. English grammar

            defcon8 wrote:[color=blue]
            > 1. Does it matter?
            > 2. Is it affecting your productivity.
            > 3. Are you not trying to programme?
            > 4. It is open source, change it and stop whining.
            >[/color]

            What about trying emacs <alt>+x doctor <return> ?

            --
            bruno desthuilliers
            python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
            p in 'onurb@xiludom. gro'.split('@')])"

            Comment

            • Boris Borcic

              #7
              Re: Python keywords vs. English grammar

              Roy Smith wrote:[color=blue]
              > I noticed something interesting today. In C++, you write:
              >
              > try {
              > throw foo;
              > } catch {
              > }
              >
              > and all three keywords are verbs, so when you describe the code, you can
              > use the same English words as in the program source, "You try to execute
              > some code, but it throws a foo, which is caught by the handler".[/color]

              Not convincing at all, since the *explicit* throw/raise lexically inside a try
              block with a catch/except clause that's *predetermined* to catch it... is the
              exception rather than the rule. Normally you'd use another form of block exit.
              Or is the case different in C++ by any chance ?
              [color=blue]
              >
              > In Python, you write:[/color]

              usually, you don't write something similar to that, and neither in C++ I guess.[color=blue]
              >
              > try:
              > raise foo
              > except:
              >
              > and now you've got a mix of verbs and (I think), a preposition. You can't
              > say, "You try to execute some code, but it raises a foo, which is excepted
              > by the handler". It just doesn't work grammatically.
              >
              > Sigh.[/color]

              Comment

              • Roy Smith

                #8
                Re: Python keywords vs. English grammar

                In article <4474d559$1_4@n ews.bluewin.ch> ,
                Boris Borcic <bborcic@gmail. com> wrote:
                [color=blue]
                > Roy Smith wrote:[/color]
                [color=blue][color=green]
                > > and all three keywords are verbs, so when you describe the code, you can
                > > use the same English words as in the program source, "You try to execute
                > > some code, but it throws a foo, which is caught by the handler".[/color]
                >
                > Not convincing at all[/color]

                I wasn't trying to convince anybody of anything. Just making an
                observation.

                Comment

                Working...