Re: [Edu-sig] How does Python do Pointers?

2008-05-04 Thread John Zelle
Hello all, This is all good explanation, but could use a bit of tweaking. Where the pointer analogy with C breaks down is that C pointers require explicit dereferencing. In this regard, the Python model is actually closer to C ++ reference variables, which are automatically dereferenced. Of course

[Edu-sig] Fwd: How does Python do Pointers?

2008-05-04 Thread Anna Ravenscroft
Martelli's response. ;-) -- Forwarded message -- From: Alex Martelli <[EMAIL PROTECTED]> Date: Sun, May 4, 2008 at 2:36 PM Subject: Re: [Edu-sig] How does Python do Pointers? To: Anna Ravenscroft <[EMAIL PROTECTED]> Cc: edu-sig@python.org With thanks to Anna for forwarding this.

[Edu-sig] How does Python do Pointers?

2008-05-04 Thread Michael H. Goldwasser
Hi Dave, For students familiar with C, the most straightforward analogy is that ALL of Python's names are akin to C's pointers. This is certainly the closest match of the three C/C++ models (value, pointer, reference). Even for new programmers with no previous knowledge, we make sure

[Edu-sig] How does Python do Pointers?

2008-05-04 Thread David MacQuigg
This was the question from a student at my recent lecture to a class of engineering students studying C. My answer was brief: It doesn't - arguments are passed by value. Then I thought, this is really misleading for students of C, where pass-by-value means making a copy of the passed object.