Javascript Replace Array Element Immutable Class Example In Python