On Sun, Jun 27, 2010 at 6:57 PM, Payal <payal-pyt...@scriptkitchen.com> wrote:
> Hello,
> Please forgive for such a silly questions. I have never taken a course on
> computers so am rough with some of basic technical terminology.
>
> a. I read in a book that "lambdas are expressions ... so they can go
> where functions are not allowed". What are expressions and what are
> statements? A simple example of both in Python will suffice.
>

an expression is anything that yields a value. Simple expressions are
1
1 + 1
a
[1, 2, 3]
True and False
lambda: 5

but anything that has a value is an expression. Expressions can be on
the right side of an assignment statement.
A statement is kind of the opposite. It does not have a value.
Examples of statements:

return 5
def x(): pass
if True: sys.exit()
while x < 4: pass

> b. I read on web that Python has in new releases done "unifications of
> types and classes". I know what classes are, what are types in simple
> language.
>

a 'type,' in python before 2.2, was simply any of the builtin types,
that is, int, str, list, dict, and so on. The unification that
happened in 2.2 means that there are no more differences between a
builtin 'type' and a user-defined 'class.' Nowadays a type is just any
instance of the type class.

Hugo
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to