On 2024-08-07 10:03, Stefan Ram <r...@zedat.fu-berlin.de> wrote: > r...@zedat.fu-berlin.de (Stefan Ram) schrieb oder zitierte: >>Dieses Nichtvorkommen legt es für mich nahe, daß die Frage >>der Veränderbarkeit des Ziels für die Bedeutung von "+=" >>nur eine begrenzte Bedeutung hat! >>|An augmented assignment evaluates the target (which, unlike >>|normal assignment statements, cannot be an unpacking) and the >>|expression list, performs the binary operation specific to >>|the type of assignment on the two operands, and assigns the >>|result to the original target. >>aus Abschnitt 7.2.1 > > Ich hatte gestern etwas übersehen! Und zwar (in bezug auf > Operatoren wie "+="): > >|Also, when possible, the actual operation is performed >|in-place, meaning that rather than creating a new object and >|assigning that to the target, the old object is modified >|instead. > 7.2.1 [...] > > (In "7.2.1" besagt "assigns the result to the original target" > eigentlich, daß "+=" sich hier wie "=" verhält.
Exakt. Der Unterschied liegt in der Implementation der Methode __iadd__, nicht in der Zuweisung. hp _______________________________________________ python-de Mailingliste -- python-de@python.org Zur Abmeldung von dieser Mailingliste senden Sie eine Nachricht an python-de-le...@python.org https://mail.python.org/mailman3/lists/python-de.python.org/ Mitgliedsadresse: arch...@mail-archive.com