lambda x: (x+:=5)
maybe. not sure about the
Ideas need to be justified.
Why do you think this is something that should be added to python?
Is it important enough to added to python given it will increase the maintenance burdon for python?
Presumably it couldn’t be automatically generated for a class that has
__imul__ since that returns
None. Which is likely to be counter-intuitive.
Edit: ignore this… It’s nonsense!
None would be highly unusual, given that it’s supposed to return the result of the multiplication: doc
Sorry you’re right. I don’t know where I’d got the idea from that it was different, but I’m clearly wrong. That’s not an issue then!
Rebinding a local name to an immutable object in a return statement is nonsensical. It would have no visible effect since the local namespace would be immediately cleared. Try again. (Or withdraw the suggestion