New submission from Zach kuunka :
I haven't used this bug reporting thing before so sorry if I mess something up.
Anyway i'm not sure exactly what is causing the issue but the issue appears
when you have a for loop looping through an array and you make a variable and
set it to that array and append something to it. If you do the same thing with
numbers it works as expected but if you do it with an array it for some reason
doesn't get reset every iteration. Run this and you'll see what i'm talking
about.
Arr = [1,2,3,4,5]
for num in Arr:
Arr2 = Arr
Arr2.append(1) #the 1 can be anything
print(Arr2)
Also i'm interested to know why this happens, Thank You
--
components: Library (Lib)
files: brokentest.py
messages: 356648
nosy: Zach kuunka
priority: normal
severity: normal
status: open
title: weird bug while using a for loop and array
type: behavior
versions: Python 3.6
Added file: https://bugs.python.org/file48716/brokentest.py
___
Python tracker
<https://bugs.python.org/issue38808>
___
___
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com