[Tutor] help with arrays
Rikard Bosnjakovic
rikard.bosnjakovic at gmail.com
Fri May 18 06:05:40 CEST 2007
On 5/18/07, Stephen Adler <adler at stephenadler.com> wrote:
> or something like that which would create a string 1000000 characters
> long. And then use that as input into the array module so that I can
> build up an array. What's the standard convention to do this?
a = " " * 1000000
> How do I create a pointer reference?
You don't. 99% in Python is by pass-by-reference. You don't need to
think in pointers like C-programmers do. Simply send a list to a
function, and a reference (not a copy) to it will be sent.
>>> l = [1,2,3]
>>> def foo(bar):
... bar[2] = 42
...
>>> foo(l)
>>> l
[1, 2, 42]
--
- Rikard - http://bos.hack.org/cv/
More information about the Tutor
mailing list