About 18,100 results
Open links in new tab
  1. python - Immutable vs Mutable types - Stack Overflow

    Nov 9, 2011 · Other immutable types include some built-in types such as int, float, tuple and str, as well as some Python classes implemented in C. A general explanation from the "Data …

  2. Why are integers immutable in Python? - Stack Overflow

    May 31, 2016 · The closest analogy will be int* versus an integer in python. In C, an integer at a location in memory can change, so in C the integer is mutable. In python, an integer is a …

  3. Why are Python strings immutable? Best practices for using them

    Mar 1, 2015 · Immutable strings are much more dangerous than mutable strings in certain contexts. A best practice list should include never temporarily storing passwords or keys as …

  4. Are Python sets mutable? - Stack Overflow

    Jan 7, 2013 · 23 Your two questions are different. Are Python sets mutable? Yes: "mutable" means that you can change the object. For example, integers are not mutable: you cannot …

  5. python - are user defined classes mutable - Stack Overflow

    Aug 22, 2012 · This includes instances of user defined classes, classes themselves, and even the type objects that define the classes. You can even mutate a class object at runtime and have …

  6. Why are python strings and tuples made immutable?

    Oct 8, 2009 · I am not sure why strings and tuples were made to be immutable; what are the advantages and disadvantage of making them immutable?

  7. immutability - Check for mutability in Python? - Stack Overflow

    Dec 8, 2010 · A type is immutable if it is a built-in immutable type: str, int, long, bool, float, tuple, and probably a couple others I'm forgetting. User-defined types are always mutable.

  8. Aren't Python strings immutable? Then why does a + " " + b work?

    72 The string objects themselves are immutable. The variable, a, which points to the string, is mutable. Consider:

  9. Mutable and Immutable Strings in python - Stack Overflow

    Nov 14, 2017 · Strings are known as Immutable in Python (and other languages) because once the initial string is created, none of the function/methods that act on it change it directly, they …

  10. How to make an immutable object in Python? - Stack Overflow

    @hlin117: Every parameter is passed as a reference to an object in Python, regardless of whether it is mutable or immutable. For immutable objects, it would be particularly pointless to …