A question on modification of a list via a function invocation

Antoon Pardon antoon.pardon at vub.be
Mon Sep 4 09:30:53 EDT 2017


Op 04-09-17 om 15:24 schreef Steve D'Aprano:
> I accept that many people dislike, or do not understand, conceptual models where
> objects can be in more than one location at once. For many people, dropping
> into the implementation and talking about references is easier to understand.
> But that doesn't make it essential.
>
> The semantics of Python is that we assign objects to names, not references to
> objects to names. There's no "get reference" or "address of" operation in
> Python. We write:

What does that mean assigning objects to names? 

>> Its because pointers have been de-first-classed (from C say, as a starting
>> point) that the disagreements arise: - One bunch feel that since they've been
>> de-first-classed they've been removed
> Pointers are not merely second-class values, like functions and procedures in
> Pascal, or strings in C. They're not values *at all*.
>
> Its not just that Python doesn't allow you to return a pointer from a function,
> or pass a pointer to a function as argument. You cannot dereference a pointer
> either, or get a pointer to an object at all. (Although you can emulate
> pointers in Python using objects.)
>
>
> For more about first-class values, see this Stackoverflow thread:
>
> https://stackoverflow.com/questions/2578872/about-first-second-and-third-class-value
>
> We can quibble whether Pascal functions are first-, second- or first-and-a-half
> class values, or whether "third-class" even makes sense, but pointers, and
> references, are not values of *any* class in Python.
>
>
>
>




More information about the Python-list mailing list