were people more upset over an assignment as an expression or the use of
:=
which the lack of in Python was one of my many reasons for choosing Python?(Jul-13-2018, 04:11 PM)micseydel Wrote:it's probably(Jul-13-2018, 03:52 PM)nilamo Wrote: I looked at the pep, and was surprised that GvR was in support of it. I was under the impression that the rule about assignment not possible in expressions was one of his original purposes in Python, as having too many things in one line can get convoluted quickly.Yeah, I was surprised too. I think having the assignment expression use a different operator from assignment statements helps, as do examples like this
if reductor := dispatch_table.get(cls): rv = reductor(x) elif reductor := getattr(x, "__reduce_ex__", None): rv = reductor(4) elif reductor := getattr(x, "__reduce__", None): rv = reductor() else: raise Error("un(deep)copyable object of type %s" % cls)
:=
to make people want to avoid it. i know i will avoid it.
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.