Experiences/guidance on teaching Python as a first programming language

Neil Cerutti neilc at norwich.edu
Wed Dec 18 16:17:34 CET 2013


On 2013-12-18, Chris Angelico <rosuav at gmail.com> wrote:
> On Wed, Dec 18, 2013 at 11:53 PM, Dave Angel <davea at davea.name> wrote:
>> Funny you should say that in the middle of a discussion about
>> lifetime.  In C, when you do the -> thing, you're now in a
>> different struct with a potentially different lifetime.  If p
>> is a local,  with auto lifetime,  then so is p.x
>>
>> So, although the two are mutually exclusive,  there's valuable
>> information hidden in the required choice.
>
> Sure, but you can figure out whether p is a local struct or a
> local pointer to some other struct by looking at its
> declaration. Do you also need to look at every usage of it? We
> don't adorn every / with a marker saying whether we're dividing
> ints or floats, and that's something that could be potentially
> useful (float division of two ints being what Py3 does). Why
> adorn pointer usage?

Indeed. Golang allows . to do member lookup for both structs and
pointers to structs.

The -> syntax perhaps was needful in the days before function
prototypes.

-- 
Neil Cerutti




More information about the Python-list mailing list