Re: How to write Smart Python programs?



Theerasak Photha wrote:

>> 2/ functions that returns a status code and modify their arguments.

Argument modification for lists with one item is *sometimes* used to
emulate full lexical closure. (or at least that's what the folks on
freenode #python told me)

sounds like they (or you) are confusing "arguments" with "free variables", though. here's an example of the latter:

def outer():
var = [value]
def inner():
var[0] = new value
inner()

here's an example of the former:

def func(var):
var[0] = new value
return something else

myvar = [value]
res = func(myvar)

the second example feels rather contrived; if you need to return multiple values, just return them.

</F>

.



Relevant Pages

  • Python Hash File Builder/Checker
    ... python script that hashes files on a system and stick them in a simple ... Hope folks find this useful. ... def hashTree: ...
    (Focus-Microsoft)
  • Re: 12-31-95 DVD B&P
    ... sorry was just kiddin round, ... the folks are in town. ... I'll def ... Prev by Date: ...
    (rec.music.phish)
  • Re: how to get next month string?
    ... Could someone help on how to use python to output the next month string like ... def nextmo: ... And for the other folks, one of these days I'll get around to writing ...
    (comp.lang.python)
  • Re: var or inout parm?
    ... You can emulate it by sticking ... the value in a container object though: ... def f: ...
    (comp.lang.python)
  • Re: [terminale] leggere pagina web
    ... import sys, urllib ... def reporthook: print a ... urllib.urlretrieve(url, file, reporthook) ... That's all folks! ...
    (it.comp.macintosh)