Bizzare lst length problem

Bruno Desthuilliers onurb at xiludom.gro
Mon Oct 9 07:11:36 EDT 2006


Ben wrote:
(OT : Ben, please stop top-posting, it's really annoying)0
> Ah - I found out why I had cast it to a string. 

cf my previous anwser on this point.

> I had not, at that
> point, worked out ho to pass the list by value rather than reference,

There's nothing like 'pass by value/pass by reference' in Python. When
passing arguments to a function, the arguments *names* are local to the
function, and the arguments "values" are really the objects you passed
to the function (not copies of these objects).

> and so was casting to a string as a stopgap measure that I then forgot
> about.  Now the problem is fixed after this group told me how to pass a
> list by value (by slicing the entire list)

It's still not "passing by value". It's just passing a *copy* of the
original list.

-- 
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb at xiludom.gro'.split('@')])"



More information about the Python-list mailing list