Has the author never given a pointer as an argument to a function before? Do they make copies of their strings and structs every time they want to pass it around? I just... I just don't understand how they could think that.
Has the author never given a pointer as an argument to a function before? Do they make copies of their strings and structs every time they want to pass it around? I just... I just don't understand how they could think that.
If you create a list "list1", set "list2 = list1", and change list1, both of the lists change. When I learned Python, this was a major source of confusion for me. Eventually I learned that in Python, instead of nothing being a pointer as it first appears, it is actually that everything is a pointer. On the other hand, while the same things occur in C++, the assignment operator does a shallow copy and anytime you are doing a pointer copy it is explicit.
Ned Batchelder is a good resource for learning many things about python, and this talk he gave at Pycon some years ago is no exception:
What a small world...
Possibly not, many devs now-days have never used a real native language.
The whole section about references was very confused. Especially for someone who supposedly knows C.
This has been one of my own annoyances with Python as well.