RE: Why can't numpy array be restored to saved value?

2020-11-26 Thread pjfarley3
> -Original Message- > From: Christian Gollwitzer > Sent: Thursday, November 26, 2020 3:26 AM > To: python-list@python.org > Subject: Re: Why can't numpy array be restored to saved value? > > Am 25.11.20 um 07:47 schrieb pjfarl...@earthlink.net: > > Why is

RE: Why can't numpy array be restored to saved value?

2020-11-26 Thread pjfarley3
> -Original Message- > From: Greg Ewing > Sent: Thursday, November 26, 2020 12:01 AM > To: python-list@python.org > Subject: Re: Why can't numpy array be restored to saved value? > > On 25/11/20 7:47 pm, pjfarl...@earthlink.net wrote: > > Why isn'

Re: Why can't numpy array be restored to saved value?

2020-11-26 Thread Christian Gollwitzer
Am 25.11.20 um 07:47 schrieb pjfarl...@earthlink.net: Why isn't the final value of the numpy array npary in the following code the same as the initial value before some but not all elements of the array were changed to a new value? I know I am missing something basic here. I thought I understoo

Re: Why can't numpy array be restored to saved value?

2020-11-25 Thread Greg Ewing
On 25/11/20 7:47 pm, pjfarl...@earthlink.net wrote: Why isn't the final value of the numpy array npary in the following code the same as the initial value before some but not all elements of the array were changed to a new value? Slicing a numpy array doesn't copy anything, it just gives you an

RE: Why can't numpy array be restored to saved value?

2020-11-25 Thread pjfarley3
Never mind, I found the numpy.copy function does what I need. Revised code below works. Sorry for wasting bandwidth. Peter --- nptest.py --- import numpy as np import sys if len(sys.argv) > 0: try: asz = int(sys.argv[1]) + 0 except: asz = 4 npary = np.full([asz, asz, a