This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author steven.daprano
Recipients paul.moore, steve.dower, steven.daprano, tim.golden, yashwanthbarad@gmail.com, zach.ware
Date 2020-07-15.08:28:02
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1594801682.82.0.757883400638.issue41301@roundup.psfhosted.org>
In-reply-to
Content
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!
History
Date User Action Args
2020-07-15 08:28:02steven.dapranosetrecipients: + steven.daprano, paul.moore, tim.golden, zach.ware, steve.dower, yashwanthbarad@gmail.com
2020-07-15 08:28:02steven.dapranosetmessageid: <1594801682.82.0.757883400638.issue41301@roundup.psfhosted.org>
2020-07-15 08:28:02steven.dapranolinkissue41301 messages
2020-07-15 08:28:02steven.dapranocreate