C pointers/Python

Stephen Thorne stephen.thorne at gmail.com
Mon Mar 21 22:10:06 EST 2005


On 21 Mar 2005 17:16:18 -0800, integer <intager at gmail.com> wrote:
> you never deal directly with pointers in python.
> in your case, you need to pass a mutable object as your 'buffer'
> argument and perform operations on it such that 'buffer==data'. (for
> example, you could use a list here.)
> def testit( buffer ):
>    for i in range( len ):
>       buffer[A+i]=data[B+i]
> for some constants A,B

That's unpythonic.

The correct solution is to return the result. Anything else is trying
to squeeze a C idiom into python for no gain.

-- 
Stephen Thorne
Development Engineer, NetBoxBlue.com



More information about the Python-list mailing list