Live data from Hacker News

What’s New in Python 3.7

docs.python.org

41–50 of 70 posts

Re: What’s New in Python 3.7

#42

Unrelated to python 3.7, but they recently added this feature that you can add two dictionaries together in 3.5 by doing: new_dict = {**dict1, **dict2} It is so handy and nice

Ah, great. This used to be rather clunky to do.

Really? This is how that was done in Python 2.7 and it doesn't seem that much clunkier to me...

    dict(dict1, **dict2)

Re: What’s New in Python 3.7

#44

Earlier quoted context omitted.

Are you American? Americans always think that changing the encoding is a minor detail. Guess what, changing the default encoding breaks every language that is not English.

If it was changed from ascii to utf-8, how does it break everyting else ?

ASCII doesn't exist as such.

Characters are encoded in one byte and ascii leaves the highest 128 characters undefined. They are interpreted system-wise, depends on the locale and user settings.

Re: What’s New in Python 3.7

#46
post #30

Earlier quoted context omitted.

Are you American? Americans always think that changing the encoding is a minor detail. Guess what, changing the default encoding breaks every language that is not English.

I'm Finnish, thank you for asking, so I'm quite aware of different encodings.

Is Finnish representable in Latin1? If so you might be missing some of the suitabilities of converting from "asci" (most things around Europe weren't asci but latin1) to utf.

Re: What’s New in Python 3.7

#47

Unrelated to python 3.7, but they recently added this feature that you can add two dictionaries together in 3.5 by doing: new_dict = {**dict1, **dict2} It is so handy and nice

Why doesn't the + symbol work?

+ is not a supported operand for dict. You can probably subclass dict and add the plus operand

Re: What’s New in Python 3.7

#49

Earlier quoted context omitted.

+ is not a supported operand for dict. You can probably subclass dict and add the plus operand

Why add that crazy syntax when a + would be a lot clearer?

It makes sense in context. {} is a dict literal, and * * dict is already used other places to expand a dict into key-value pairs.

Given

  a = {1: 1}
  b = {2: 2}
This

  c = {**a, **b}
is equivalent to

  c = {1: 1, 2: 2}

Re: What’s New in Python 3.7

#50
post #42

Earlier quoted context omitted.

Ah, great. This used to be rather clunky to do.

Really? This is how that was done in Python 2.7 and it doesn't seem that much clunkier to me... dict(dict1, **dict2)

Interesting. I never thought of that. I also asked a question about this on StackOver flow once and no one suggested that. Very useful.
Post reply on HN