Are routine objects guaranteed mutable & with dictionary?

MRAB python at mrabarnett.plus.com
Sun Dec 6 20:18:10 EST 2009


Alf P. Steinbach wrote:
 > * Dennis Lee Bieber:
 >> On Sat, 05 Dec 2009 11:26:34 +0100, "Alf P. Steinbach"
 >> <alfps at start.no> declaimed the following in
 >> gmane.comp.python.general:
 >>
 >>> The devolution of terminology has been so severe that now even the
 >>> Wikipedia article on this subject confounds the general concept of
 >>> "routine" with the far more specialized term "sub-routine", which
 >>> is just one kind of routine. It is of
 >>
 >>     Well, if this were a FORTRAN IV text from the mid-70s you'd be
 >> talking about
 >>
 >>         function subprograms
 >> and
 >>         subroutine subprograms
 >
 > It's in that direction yes, but the distinction that you mention,
 > which is essentially the same as Pascal 'function' versus
 > 'procedure', or Visual Basic 'function' versus 'sub', is just a
 > distinction of two variants of subroutines.
 >
 > Up above there is the more general concept of a routine, where there
 > are more possibilites than just subroutines; Python generators are
 > one example.
 >
 > As I mentioned earlier, in Eiffel, which is a more modern language
 > than Fortran, routines are still called routines. And specialized
 > terms include "routine". So it's not like that language independent
 > terminology has been phased out in general; it's mostly only in the C
 > syntax family (e.g. Python operators come mostly from C) that
 > "function" is, misleadingly and with associated severe constraints,
 > used as a general term.
 >
In C there were originally only functions; if you didn't specify a
return type then it would default to 'int' ('void' was a later
addition).

In Python there are only functions; if you don't explicitly return a
value then None is returned.

The distinction between functions and procedures can be helpful in
deciding whether something is Pythonic (for example, in the use of list
comprehensions), but in reality they are all still functions.



More information about the Python-list mailing list