[Tutor] Glossory of terms in Python

Alan Gauld alan.gauld at freenet.co.uk
Wed Oct 26 19:50:54 CEST 2005

> While reading these books step-by-step and progressing
> ahead, I feel that some of the terms are highly
> volatile.  In simple terms, while reading about lambda
> functions after reading a lot of stuff before, I am
> unable to clearly define what is an expression and
> what is a statement.  

Good catch. One of the things I tried very hard to do was 
define all these computer terms as I used them. 
But obviously I missed a few!

An expression is anything that can go on the right hand side 
of an assignment. ie it can be evaluated.

A statement is a little more tricky since it varies slightly from 
language to language. Basically its any single line that can be 
typed into the Python >>> prompt without raising an error
(including multiple lines where the \ character or unmatched 
brackets are used!) Statements may be expressions or include 
expressions. Thus

var = E

is a statement containing the expression E


is both a statement and an expression!

if E1 >- E2: print 42

is a statement that utilised two expressions E1 and E2 to form a third 
expression (E1 >=E2) the result of which determines the outcome of 
the statement.

Thats not a rigorous definition, for that you should read the language 
reference in the documentation. But hoppefully goves a flavour of 
the meanings.

> Although, I know the difference and what exactly they
> mean inherently in my mind, I am unable to comprehend
> and move ahead. This reamins a stumblick block.  

> a. Statement - A statement is .......... . For eg.
> xxxxxx is called a statment
> b. Expression - An expression is something ........ .
> For example, def f(x): xxx  return y is an expression.

actually in that example only y is an expression, the rest are statements!

> c. Jump table: A jump table is a table where ......

I don't cover jump tables in my tutor but if I did I'd certainly 
define it :-)

> d. Attribute : An attribute is a variable that is used
> as an input to a function. For eg. def Xabl(a): here a
> is an attribute. 

Nope a is a parameter. The value passed in when you 
call XAbl() is an argument.

An attribute is an internal field of an object, usially a data field 
but sometimes methods are called attributes too.

> Such a glossory of terms would be a great gift from
> python experts. 

Actually it would be good for programmers in geneal.
The best I can think of is the Wikipedia. For example 
on the difference between statements and expressions see:


It certainly dscribes all the terms you have listed so far...

> This would help novice and learning and programmers 
> who never talked the terms of computing language in 
> daily english. 

It sounds like a great idea and would encourage you to start
one straight way. Tell the usenet community and you will 
instantly receive lots of 'feedback'. Don't take any of it 
personally but use it to improve your site. You should fairly 
quickly become the owner of a frequently visited and useful 
internet resource.

I mean it, just do it and you will have contributed. You might 
even become an "internet hero" :-)

Alan G
Author of the learn to program web tutor

More information about the Tutor mailing list