+ 1

What are in place operators ?

The definition given in the app is very confusing, pls help out with an understandable example

7th Dec 2017, 5:10 AM
Robin Joseph
Robin Joseph - avatar
2 Answers
+ 4
Good question! I think they are operators that modify their arguments, rather than create new values. In Python, arr.sort() modifies list arr. So we say it sorts "in place". However, sorted(arr) leaves arr unchanged, and creates a new list.
7th Dec 2017, 5:22 AM
Eric Blinkidu
Eric Blinkidu - avatar
7th Dec 2017, 5:38 AM
Eric Blinkidu
Eric Blinkidu - avatar