List Problem

Chris Angelico rosuav at gmail.com
Sun Sep 23 18:45:16 EDT 2012


On Mon, Sep 24, 2012 at 8:37 AM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
> On Mon, 24 Sep 2012 08:27:28 +1000, Chris Angelico wrote:
>
>> C simply doesn't let you move
>> arrays around, only pointers to them, so semantics are actually pretty
>> similar to high level languages, only in a completely different way.
>
> I once dated a girl who looked exactly like Scarlett Johannsen only
> completely different.
>
> Pascal let's you pass arrays around either by value (which copies them,
> and may be expensive) or by reference (which doesn't), neither of which
> is what Python (or Java, Ruby, etc.) do. Passing pointers by value is not
> the same as Python object semantics.

If your arrays are allocated on the heap, you can pretty much treat
the pointer like a HLL list object. The only real difference is that
C, by default, won't garbage-collect your heap allocations, so you'll
leak memory. The behaviours you observe will be pretty similar,
though.

ChrisA



More information about the Python-list mailing list