[Python-ideas] Default arguments in Python - the return

spir denis.spir at free.fr
Sat May 9 14:34:08 CEST 2009


Le Sat, 09 May 2009 12:56:20 +0200,
Pascal Chambon <chambon.pascal at wanadoo.fr> s'exprima ainsi:

> If people want static variables in python, for example to avoid OO 
> programming and still have stateful functions, we can add an explicit 
> "static" keyword or its equivalent.

This is far from beeing pythonic anyway, I guess. Ditto for storing data on the func itself (as shown in another post). It provide a way of linking together data and behaviour; similar techniques are used e.g. in Lisp, so that many Lisp people find OO pretty useless.
But python has OO in-built, and even as mainsteam paradigm. Data related to behaviour should be set on an object.

> But using the ambiguous value given 
> via a default-valued argument is not pretty, imo.
> Unless we have a way to access, from inside a code block, the function 
> object in which this code block belongs.
> 
> Does it exist ? Do we have any way, from inside a call block, to browse 
> the default arguments that this code block might receive ?

This is a feature of much more reflexive/meta languages like Io (or again Lisp), that were indeed designed from scratch with this capacity in mind and intended as a major programming feature.
In Io you can even access the 'raw' message _before_ evaluation, so that you get the expression of argument, not only the resulting value.

Denis
------
la vita e estrany



More information about the Python-ideas mailing list