python and macros (again) [Was: python3: 'where' keyword]

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tim Jarman

    #31
    Re: python and macros (again) [Was: python3: 'where' keyword]

    Skip Montanaro wrote:
    [color=blue]
    >
    > Fredrik> no, expressions CAN BE USED as statements. that doesn't mean
    > Fredrik> that they ARE statements, unless you're applying belgian
    > logic.
    >
    > Hmmm... I'd never heard the term "belgian logic" before. Googling
    > provided a few uses, but no formal definition (maybe it's a European
    > phrase so
    > searching for it in English is futile). The closest thing I found was
    >
    > Or is it another case of Belgian logic, where you believe it because
    > theres no evidence or motive whatsoever?
    >
    > Fredrik> no, it's Python, and it's designed this way on purpose. go
    > Fredrik> read the language reference.
    >[/color]
    <snip>

    IANA French person, but I believe that Belgians are traditionally
    regarded as stupid in French culture, so "Belgian logic" would be
    similar to "Irish logic" for an English person. (Feel free to insert
    your own cultural stereotypes as required. :)

    --
    Website: www DOT jarmania FULLSTOP com

    Comment

    • Carl Banks

      #32
      Re: python and macros (again) [Was: python3: 'where' keyword]


      Tim Jarman wrote:[color=blue]
      > IANA French person, but I believe that Belgians are traditionally
      > regarded as stupid in French culture, so "Belgian logic" would be
      > similar to "Irish logic" for an English person. (Feel free to insert
      > your own cultural stereotypes as required. :)[/color]

      Ok.

      Belgian: 1. Belching or someone who belches a lot. Also "Belgian accent". 2. Speaking Belgian = to talk while belching. Also "Belgian accent".

      --
      CARL BANKS

      Comment

      • Roel Schroeven

        #33
        Re: python and macros (again) [Was: python3: 'where' keyword]

        Skip Montanaro wrote:[color=blue]
        > Fredrik> no, expressions CAN BE USED as statements. that doesn't mean
        > Fredrik> that they ARE statements, unless you're applying belgian logic.
        >
        > Hmmm... I'd never heard the term "belgian logic" before. Googling provided
        > a few uses, but no formal definition (maybe it's a European phrase so
        > searching for it in English is futile).[/color]

        I'm from Belgium, and I've never heard it before either. Probably a
        public secret, very carefully being kept hidden from us Belgians ;)

        --
        "Codito ergo sum"
        Roel Schroeven

        Comment

        • Roel Schroeven

          #34
          Re: python and macros (again) [Was: python3: 'where' keyword]

          Antoon Pardon wrote:[color=blue]
          > IMO we have a: dogs are mamals kind of relationship in Python.[/color]

          I see what you mean, but I don't think it's true.
          [color=blue]
          > Every expression can be used where a statement is expected.
          > (And this can be worded as: every expression is a statement.)[/color]

          Not really. An expression statement is a statement that looks like an
          expression, but actually it's more than that: not only does it calculate
          the value of the expression, it also prints the value.

          Note that it would be perfectly possible to modify the syntax into

          expression_stmt ::= "exprstmt" expression_list

          so that you would have to write

          exprstmt 6*9

          instead of just

          6*9

          That makes it clearer to see the distinction: 6*9 is an expression,

          exprstmt 6*9

          is a statement. An expression statement, more precisely.
          [color=blue]
          > Not every statement can be used where an expression is expected.[/color]

          AFAIK *no* statement can be used where an expression is expected.

          --
          "Codito ergo sum"
          Roel Schroeven

          Comment

          • Antoon Pardon

            #35
            Re: python and macros (again) [Was: python3: 'where' keyword]

            Op 2005-01-14, Roel Schroeven schreef <rschroev_nospa m_ml@fastmail.f m>:[color=blue]
            > Antoon Pardon wrote:[color=green]
            >> IMO we have a: dogs are mamals kind of relationship in Python.[/color]
            >
            > I see what you mean, but I don't think it's true.
            >[color=green]
            >> Every expression can be used where a statement is expected.
            >> (And this can be worded as: every expression is a statement.)[/color]
            >
            > Not really. An expression statement is a statement that looks like an
            > expression, but actually it's more than that: not only does it calculate
            > the value of the expression, it also prints the value.[/color]

            1) Only in an interactive environment.

            2) That the semantics differ according to where the expression is
            used doesn't make a difference. That an expression decides which
            branch of an if statement is executed or what object is pass
            as an argument in a call are also semantic difference, yet
            we still have an expression in both cases.
            [color=blue]
            > Note that it would be perfectly possible to modify the syntax into
            >
            > expression_stmt ::= "exprstmt" expression_list
            >
            > so that you would have to write
            >
            > exprstmt 6*9
            >
            > instead of just
            >
            > 6*9
            >
            > That makes it clearer to see the distinction: 6*9 is an expression,
            >
            > exprstmt 6*9
            >
            > is a statement. An expression statement, more precisely.[/color]

            If you change the syntax, of course you will change the strings
            that will be accepted. I could change the syntax to:

            if_stmt ::= "if" "ifexpr" expression ...

            Have I now proved that expressions after an if are not normal
            expressions?
            [color=blue]
            >[color=green]
            >> Not every statement can be used where an expression is expected.[/color]
            >
            > AFAIK *no* statement can be used where an expression is expected.[/color]

            But that was not the implication of what Guido supposedly had said.
            So that this is not the case doesn't counter what I said.

            --
            Antoon Pardon

            Comment

            • Fredrik Lundh

              #36
              Re: python and macros (again) [Was: python3: 'where' keyword]

              Antoon Pardon wrote:
              [color=blue]
              > Well IMO I have explained clearly that I understood this in a set
              > logical sense in my first response.[/color]

              what does "first" mean on your planet?

              </F>



              Comment

              • Roel Schroeven

                #37
                Re: python and macros (again) [Was: python3: 'where' keyword]

                Antoon Pardon wrote:[color=blue]
                > Op 2005-01-14, Roel Schroeven schreef <rschroev_nospa m_ml@fastmail.f m>:
                >[color=green]
                >>Antoon Pardon wrote:
                >>[color=darkred]
                >>>IMO we have a: dogs are mamals kind of relationship in Python.[/color]
                >>
                >>I see what you mean, but I don't think it's true.
                >>
                >>[color=darkred]
                >>>Every expression can be used where a statement is expected.
                >>>(And this can be worded as: every expression is a statement.)[/color]
                >>
                >>Not really. An expression statement is a statement that looks like an
                >>expression, but actually it's more than that: not only does it calculate
                >>the value of the expression, it also prints the value.[/color]
                >
                >
                > 1) Only in an interactive environment.[/color]

                True, I wanted to add that but forgot it. Doesn't change what I'm saying
                though.
                [color=blue]
                > 2) That the semantics differ according to where the expression is
                > used doesn't make a difference. That an expression decides which
                > branch of an if statement is executed or what object is pass
                > as an argument in a call are also semantic difference, yet
                > we still have an expression in both cases.[/color]

                In both cases we have an expression, in both cases we have a statement,
                in both cases the expression is a part of the statement. In one case the
                expression is the only statement, in the other case the statement has
                other parts too.
                [color=blue]
                >[color=green]
                >>Note that it would be perfectly possible to modify the syntax into
                >>
                >>expression_st mt ::= "exprstmt" expression_list
                >>...[/color]
                >
                > If you change the syntax, of course you will change the strings
                > that will be accepted. I could change the syntax to:
                >
                > if_stmt ::= "if" "ifexpr" expression ...
                >
                > Have I now proved that expressions after an if are not normal
                > expressions?[/color]

                No, you still have a statement with one or more parts, one of which is
                an expression.

                In OOP terms: I think that an expression statement 'has an' expression
                (I agree that is a very thin wrapper though), not that an expression
                statement 'is an' expression.
                [color=blue][color=green][color=darkred]
                >>>Not every statement can be used where an expression is expected.[/color]
                >>
                >>AFAIK *no* statement can be used where an expression is expected.[/color]
                >
                >
                > But that was not the implication of what Guido supposedly had said.
                > So that this is not the case doesn't counter what I said.[/color]

                Whether statements can be used in the place of expressions is indeed not
                relevant to the discussion.

                Regarding what Guido apparently said:

                Op 2005-01-12, Steve Holden schreef <steve@holdenwe b.com>:[color=blue][color=green]
                >> Given that Guido is on record as saying that expressions aren't
                >> statements because he wants those things to be separate[/color][/color]

                Antoon Pardon wrote:[color=blue]
                > Well, it seems that Guido is wrong then. The documentation clearly
                > states that an expression is a statement.[/color]

                I don't think it says that at all.
                [color=blue]
                > More specifically, everywhere you can use a statement, you can
                > simply use an expression according to the python syntax.[/color]

                If you use an expression where a statement is expected, you really
                write an expression statement that contains the expression (and nothing
                else, but that doesn't matter).

                --
                "Codito ergo sum"
                Roel Schroeven

                Comment

                • Steve Holden

                  #38
                  Re: python and macros (again) [Was: python3: 'where' keyword]

                  Paul Rubin wrote:
                  [color=blue]
                  > "Fredrik Lundh" <fredrik@python ware.com> writes:
                  >[color=green][color=darkred]
                  >>>Huh? Expressions are not statements except when they're "expression
                  >>>statements "? What kind of expression is not an expression statement?[/color]
                  >>
                  >>any expression that is used in a content that is not an expression statement,
                  >>of course.[/color]
                  >
                  >
                  > Come on, that is vacuous. The claim was "expression s are not
                  > statements". But it turns out that expressions ARE statements. The
                  > explanation is "well, that's because they're expression statements".
                  > And there is no obvious case of an expression that can't be used as a
                  > statement. So it's not inherently obvious that there needs to be any
                  > kind of statement that can't be used as an expression. It's just an
                  > artifact. Whether the artifact is a desirable one is a matter of
                  > discussion.[/color]

                  Excuse me, coould we get back to discussing how many angels can dance on
                  the head of a pin?

                  or-something-interesting-like-that-sly y'rs - steve
                  --
                  Steve Holden http://www.holdenweb.com/
                  Python Web Programming http://pydish.holdenweb.com/
                  Holden Web LLC +1 703 861 4237 +1 800 494 3119

                  Comment

                  Working...