Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > python and macros (again) [Was: python3: 'where' keyword]

Reply
Thread Tools

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

 
 
Tim Jarman
Guest
Posts: n/a
 
      01-14-2005
Skip Montanaro wrote:

>
> 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.
>

<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
 
Reply With Quote
 
 
 
 
Carl Banks
Guest
Posts: n/a
 
      01-14-2005

Tim Jarman wrote:
> 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.


Ok.

http://www.urbandictionary.com/defin...rm=belgian&r=f
--
CARL BANKS

 
Reply With Quote
 
 
 
 
Roel Schroeven
Guest
Posts: n/a
 
      01-14-2005
Skip Montanaro wrote:
> 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).


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
 
Reply With Quote
 
Roel Schroeven
Guest
Posts: n/a
 
      01-14-2005
Antoon Pardon wrote:
> IMO we have a: dogs are mamals kind of relationship in Python.


I see what you mean, but I don't think it's true.

> Every expression can be used where a statement is expected.
> (And this can be worded as: every expression is a statement.)


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.

> Not every statement can be used where an expression is expected.


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

--
"Codito ergo sum"
Roel Schroeven
 
Reply With Quote
 
Antoon Pardon
Guest
Posts: n/a
 
      01-14-2005
Op 2005-01-14, Roel Schroeven schreef <(E-Mail Removed)>:
> Antoon Pardon wrote:
>> IMO we have a: dogs are mamals kind of relationship in Python.

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

>
> 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.


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.

> 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.


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?

>
>> Not every statement can be used where an expression is expected.

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


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
 
Reply With Quote
 
Fredrik Lundh
Guest
Posts: n/a
 
      01-14-2005
Antoon Pardon wrote:

> Well IMO I have explained clearly that I understood this in a set
> logical sense in my first response.


what does "first" mean on your planet?

</F>



 
Reply With Quote
 
Roel Schroeven
Guest
Posts: n/a
 
      01-14-2005
Antoon Pardon wrote:
> Op 2005-01-14, Roel Schroeven schreef <(E-Mail Removed)>:
>
>>Antoon Pardon wrote:
>>
>>>IMO we have a: dogs are mamals kind of relationship in Python.

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

>>
>>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.

>
>
> 1) Only in an interactive environment.


True, I wanted to add that but forgot it. Doesn't change what I'm saying
though.

> 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.


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.

>
>>Note that it would be perfectly possible to modify the syntax into
>>
>>expression_stmt ::= "exprstmt" expression_list
>>...

>
> 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?


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.

>>>Not every statement can be used where an expression is expected.

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

>
>
> 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.


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 <(E-Mail Removed)>:
>> Given that Guido is on record as saying that expressions aren't
>> statements because he wants those things to be separate


Antoon Pardon wrote:
> Well, it seems that Guido is wrong then. The documentation clearly
> states that an expression is a statement.


I don't think it says that at all.

> More specifically, everywhere you can use a statement, you can
> simply use an expression according to the python syntax.


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
 
Reply With Quote
 
Steve Holden
Guest
Posts: n/a
 
      01-14-2005
Paul Rubin wrote:

> "Fredrik Lundh" <(E-Mail Removed)> writes:
>
>>>Huh? Expressions are not statements except when they're "expression
>>>statements"? What kind of expression is not an expression statement?

>>
>>any expression that is used in a content that is not an expression statement,
>>of course.

>
>
> Come on, that is vacuous. The claim was "expressions 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.


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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
macros-loop? calling macros X times? Andrew Arro C Programming 2 07-24-2004 09:52 AM
Explanation of macros; Haskell macros mike420@ziplip.com Python 80 11-07-2003 02:22 AM
Re: Explanation of macros; Haskell macros Michael T. Babcock Python 0 11-03-2003 01:54 PM
Re: Explanation of macros; Haskell macros mike420@ziplip.com Python 5 11-01-2003 01:09 AM
Re: Explanation of macros; Haskell macros mike420@ziplip.com Python 1 10-07-2003 04:07 PM



Advertisments