Loptr Chaote wrote:
On Wed, 15 Dec 2004 19:58:56 -0500, Brian van den Broek

1) Every operation has a return value [unless purposefully left out]
This includes, but is not limited to; mathematical operations (of
course), variable assignment, compare blocks, etc..

A small correction: every function has a return value. If left out (that is, no return statement) then it returns None. E.g.


>>> def noret():
...     2 + 2
...     
>>> print noret()
None
>>>

Statements have no return value, e.g.

>>> a = 1
>>> print a = 1
Traceback (  File "<interactive input>", line 1
    print a = 1
            ^
SyntaxError: invalid syntax

Like the above shows, assigment has no return value -- it's a statement. This is precisely the distinction between a *statement* (like assignment) and an expression (like a function call). Python has this distinction like most languages. A language like Scheme doesn't since everything is an expression.

With my best regards,
G. Rodrigues
_______________________________________________
Tutor maillist  -  [EMAIL PROTECTED]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to