
Oct. 8, 2023
6:44 p.m.
On 2023-10-09 02:17, Dom Grigonis wrote:
Is there a reason why this is not allowed?
return (self.mode := self.mode_valid(mode))
The principal use-case for the operator is in conditions, for example: if m := re.match(pattern_1, string): ... elif m := re.match(pattern_2, string): ... else: ... or: while line := file.readline(): ... Do you have a convincing argument that it should be expanded from a simple name? Having: self.mode = self.mode_valid(mode) return self.mode isn't too bad.