So, I'm fairly proficient at Python, but learned it back in 2.2/2.3 or so and kept up until about 3.5. Lately I have the feeling that 3.7 and particularly 3.8 are game-changers.
Are there any resources to re-learn modern , but assuming that one already knows it?
Just don't feel like going through all the changelogs and PEPs >,<.

@evilham I like this one to merge two dicts

z = {**x, **y}

OMG, that I didn't know! I think I'd have z = dict(x.items()+y.items())

@tuttle @evilham there is the pipe/update operand `dict1 | dict2` for doing that, overwriting old values. If you want to keep the old values the operand is the merge `dict1 |= dict2`.
That's valid from python 3.9 or 3.8, I don't remember.

Nice! This is the kind of thing I want to be learning, without having someone explain for loops and generators to me :-D

@evilham @tuttle look at the "what's new" section on the website. There is one for every new version of python. Those are not always best practices, though.

@laExpe @tuttle
I was pointed at this, which is quite exactly what I wanted!
(changing 37 for 36/38/39/310 goes to the corresponding python version :-)

@evilham Yeah dataclasses and type safe constructors are easy to learn and nice.

@bionade24 I'm more looking for the little awesome things like f-strings, type hints (and actually using them), the ways packaging has changed, etc.
The basis of the language is the same, even after all the byte/unicode and generator changes; those I have picked up on, but there are a bunch of more "minor" things I haven't.
So, in a way, I need to re-learn Python, but also I know it already, and there doesn't seem to be material addressing this particular situation.

Sign in to participate in the conversation – a Fediverse instance for & by the Chaos community