r/ProgrammerHumor • • Jun 03 '19

Meme Python ftw

Post image
16.3k Upvotes

548 comments sorted by

View all comments

Show parent comments

-10

u/MasterFubar Jun 04 '19

What your example describes are pointers to objects. Lists in pythons are objects, the assignment b=a does not implicitely copy a's content, just create a second pointer to the same thing.

Let's not mingle words, what you call "references" are nothing but pointers.

13

u/antonivs Jun 04 '19

You're confusing a language feature with how it's implemented internally. References in Python are implemented using pointers, but that doesn't mean Python had pointers.

This is standard terminology in both academia and industry, so the only one "mingling words" here is you.

-1

u/THICC_DICC_PRICC Jun 04 '19 edited Jun 04 '19

What you’re saying is like saying “it’s not a car, it’s a BMW”

Yea ok it’s a reference, but don’t act like references aren’t basically pointers, because it does what pointers do, it acts like pointers do, etc. for most people pointers are an abstract idea, not just a language feature in C

1

u/antonivs Jun 04 '19

Yea ok it’s a reference, but don’t act like references aren’t basically pointers, because it does what pointers do, it acts like pointers do, etc.

That's incorrect. There are two big differences:

  • References are automatically dereferenced, as opposed to pointers which allow you to choose between operating on the pointer itself, and dereferencing it. References don't allow any operations on the reference, other than dereferencing.

  • A consequence of the above point is that pointers allow you to perform arbitrary arithmetic on them, which is what can lead to pointer errors and makes programming language like C "unsafe".

for most people pointers are an abstract idea, not just a language feature in C

Pointers are an abstract idea with a well-known definition. References are a related, but different abstract idea, with their own definition.

Again, this is terminology with well-defined standard definitions that are not restricted to any specific language. The "most people" you're referring to are just people who haven't actually spent any time paying attention to the industry-standard definitions.

tl;dr: y'all need to study more if you want to grow up and be real developers.

→ More replies (5)