New submission from Steven D'Aprano <steve+pyt...@pearwood.info>:

Sorry Yashwanthbarad, this isn't a bug, you expect the wrong result.

Augmented assignment for lists is documented to be the same as calling the 
extend method, which means your AppenedFuncShortHandOperator function modifies 
the argument list in-place.

The AppenedFuncRegularAssignment simply replaces the *local variable* inside 
the function with a new list. Since it doesn't return the new list, the new 
list gets thrown away when the function returns, leaving the original list 
untouched.

This is not a bug, it is the normal behaviour. If you need help understanding 
why it works the way it does, and the difference between mutating an object and 
binding a new object to a local variable, there are many places you can ask for 
help, such as Stackoverflow, the /learnpython sub-reddit on Reddit, the tutor 
mailing list and others.

https://mail.python.org/mailman/listinfo/tutor

Good luck!

----------
nosy: +steven.daprano
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue41301>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to