Hi,
This is an important difference. In the first case (back_calc[i] =
Minty[i]), what is happening is that your are copying the data into a
pre-existing structure. In the second case (back_calc = Minty), the
existing back_calc structure will be overwritten. Therefore the
back_calc structure in the calling code will be modified in the first
case but not the second. Here is some demo code:
def mod1(x):
x[0] = 1
def mod2(x):
x = [3, 2]
x = [0, 2]
print(x)
mod1(x)
print(x)
mod2(x)
print(x)
I don't know of a way around this.
Regards,
Edward
On 5 May 2014 17:42, Troels Emtekær Linnet <[email protected]> wrote:
> Hi Edward.
>
> In the library function of b14.py, i am looping over
> the dispersion points to put in the data.
>
> for i in range(num_points):
>
> # The full formula.
> back_calc[i] = Minty[i]
>
> Why can I not just set:
> back_calc = Minty
>
> _______________________________________________
> relax (http://www.nmr-relax.com)
>
> This is the relax-devel mailing list
> [email protected]
>
> To unsubscribe from this list, get a password
> reminder, or change your subscription options,
> visit the list information page at
> https://mail.gna.org/listinfo/relax-devel
_______________________________________________
relax (http://www.nmr-relax.com)
This is the relax-devel mailing list
[email protected]
To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-devel