[issue36741] Variable about function and list

2019-04-27 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

No problem, closing this as not a bug.

--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed
type: compile error -> behavior

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36741] Variable about function and list

2019-04-27 Thread 張晨韜

張晨韜  added the comment:

Sorry. This is my first time to use this.Next time I'll notice.
Thanks a lot for your fast and patient answer.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36741] Variable about function and list

2019-04-27 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

You are passing a reference to the list so changes in Flash are made to the 
actual variable. Using cards.copy() instead of cards passes a copy of the list 
and hence modifications inside the function won't affect the original list.

This is not a bug in CPython and it's more suited python-tutor mailing list. 
Also in future bug reports please paste the program and output than images.

Thanks

--
nosy: +xtreak

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36741] Variable about function and list

2019-04-27 Thread 張晨韜

New submission from 張晨韜 :

Hello,I'm a Taiwanese student.
First,I will say sorry because of my poor English.If I have an offense,please 
forgive me.
Then,look at the picture about program.I declare a list "cards" to the function 
"Flush",and divide them by 13 in the function.The function Flash will return 
boolean finally. After that,I write "main" which declare a list and call 
"Flush" for it to show what value it is.However,when I print this list 
again,its value will be changed.
I'm confused that isn't Flush.cards a local variable belong to Flush? Why Flush 
can change the list's value for the other function without return? I asked my 
friend and he was confused,too.So I send this issue and hope to know why it 
is.Thanks.

--
components: Windows
files: 未命名.png
messages: 340982
nosy: paul.moore, steve.dower, tim.golden, zach.ware, 張晨韜
priority: normal
severity: normal
status: open
title: Variable about function and list
type: compile error
versions: Python 3.6
Added file: https://bugs.python.org/file48288/未命名.png

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com