Why are Python strings immutable? Best practices for using them

前端 未结 6 1614
后悔当初
后悔当初 2020-12-02 12:43
  1. What are the design reasons of making Python strings immutable? How does it make programming easier?
  2. I\'m used to mutable strings, like the ones in C. How am
6条回答
  •  抹茶落季
    2020-12-02 13:29

    1. Immutable objects are automatically threadsafe.
    2. You will find that using Python strings is trivially easy in comparison to the extreme pain associated with strings in C.

提交回复
热议问题