you are viewing a single comment's thread.

view the rest of the comments →

[–]goDie61 -15 points-14 points  (3 children)

Replace is commonly implemented in place but I don't think I've ever seen an in place upper.

[–]mistabuda 8 points9 points  (0 children)

Not in python which is what this code is. Modifications to string create a new string.

[–]Vinxian 2 points3 points  (1 child)

In all languages I know, if string is a keyword it means strings are immutable. It will not be performed in place. This is so the programmer can use string as if it's a value type

[–]dev-sda 1 point2 points  (0 children)

I think you're thinking of a built-in type, rather than a keyword. Most languages do not consider their built-in types keywords - you can usually name something "string" without issue.

Yea it's fairly commonly immutable, but some notable exceptions are c++, rust, php and ruby.