3

This question came up on my review queue, and I'm wondering if there's a canonical version of these "X variable (or name or whatever they're called in Python) gets mutated by changing a different reference to it" questions.

These kinds of questions spring up fairly frequently for other languages, so I thought maybe there was a canonical dupe question for Python.

8
  • 1
    Have a look in sopython.com/canon
    – jonrsharpe
    Oct 3, 2016 at 6:39
  • @jonrsharpe handy resource, but not for closing as a duplicate :) if I come across python questions that look common though, I'll try to remember to link to that if it seems appropriate.
    – Jeff
    Oct 3, 2016 at 7:13
  • 1
    No, don't link to it - use it to find the dupes! They're all links to canonical questions here on SO.
    – jonrsharpe
    Oct 3, 2016 at 7:15
  • 1
    If you have no idea then press the Skip button. Oct 3, 2016 at 8:11
  • @jonrsharpe oh! I clicked through but didn't see the link through to the question - thanks :)
    – Jeff
    Oct 3, 2016 at 8:31
  • @HansPassant that's exactly what I did in this case (and many others), but it's always good to try to learn more.
    – Jeff
    Oct 3, 2016 at 8:32
  • Apparently not (from looking at the canon), so please create one. Tagged both Python and numpy, I recommend. I suggest we want to illustrate with both a pure Python example (e.g. list/object), and a numpy array one.
    – smci
    Dec 5, 2016 at 20:47
  • @smci I've never written a line of Python in my life, so I'm probably not best equipped to ask it, much as I might like the reputation :P feel free to "steal" my thunder on this one (and don't forget to post an answer here if you do!).
    – Jeff
    Dec 5, 2016 at 20:59

0

You must log in to answer this question.

Browse other questions tagged .