Live data from Hacker News

What’s New in Python 3.8

docs.python.org

201–210 of 381 posts

Re: What’s New in Python 3.8

#201
post #85

Earlier quoted context omitted.

The Mac has provided easy access to symbols since 1984, with nice mnemonics like these: option-= ≠ option- ≥ option-/ ÷ option-o ø option-w ∑ I don't know why other OSes haven't adopted something similar. The first couple of these were even idiomatic in HyperCard's scripting language.

> nice mnemonics like these: > option-w ∑ This would grate on me every single time I had to use it. It's an S. Put it on option-s.

For context opt s is ß so the decision wouldn’t be easy if you want to include both.

Re: What’s New in Python 3.8

#202

I like the additions of the f-strings and walrus operator, but I find myself wishing a breaking-release removing the old features that the new features covers. Python's philosophy was to have one way to do something, but the current situation of Python is very inconsistent. Python 3 has like 4~5 ways to format strings, and due to the addition of the walrus operator, we have (I understand the differences between := an…

Perhaps Python itself could worn you that certain constructs are deprecated and will be removed in future versions.

And you could 'import something from future' to opt-in to making those warnings errors right now.

Re: What’s New in Python 3.8

#203
post #202

I like the additions of the f-strings and walrus operator, but I find myself wishing a breaking-release removing the old features that the new features covers. Python's philosophy was to have one way to do something, but the current situation of Python is very inconsistent. Python 3 has like 4~5 ways to format strings, and due to the addition of the walrus operator, we have (I understand the differences between := an…

Perhaps Python itself could worn you that certain constructs are deprecated and will be removed in future versions. And you could 'import something from future' to opt-in to making those warnings errors right now.

That's a pretty good idea, deprecating & warning + providing automatic conversion utilities + using 'future' to make them errors... But that won't happen :-(

Re: What’s New in Python 3.8

#204

Disappointing that Python sill has no support for a sorted container in its standard library, akin to C++ `set` or `map` classes.

What's the value of a sorted map over an ordered map? I don't think I've ever cared to iterate over map values based on the alphanumeric ordering of their keys.

In Haskell we use sorted maps as persistent data structures. Persistent in this context means that the insert-method returns a new map and the old map is still around, if you need it.

It's basically copy-on-write. The old and new map share all but O(log n) data.

You could probably do something like that with an unsorted map, but it's a good fit for a sorted one.

Re: What’s New in Python 3.8

#205
post #133

Earlier quoted context omitted.

I would love if they added "?" to the list of valid characters for names, so I could write something like `valid?()` instead of ``is_valid()`.

just use "_P", a fairly-widely-recognized substitute from the Lisp world.

As a python programmer I would have no idea what `valid_P` is supposed to mean. Valid Pascals?

Re: What’s New in Python 3.8

#206
post #133

Earlier quoted context omitted.

> As a developer who has primarily developed applications in Python for his entire professional career, I can't say I'm especially excited about any of the "headlining" features of 3.8. Python is a fairly old, mature language. What features would you have been especially excited about?

I would love if they added "?" to the list of valid characters for names, so I could write something like `valid?()` instead of ``is_valid()`.

Ruby to the rescue!

Re: What’s New in Python 3.8

#207

Earlier quoted context omitted.

> As a developer who has primarily developed applications in Python for his entire professional career, I can't say I'm especially excited about any of the "headlining" features of 3.8. Python is a fairly old, mature language. What features would you have been especially excited about?

I'd really like a way to refer to a variable in a outer scope (like global... but not just for global variables).

... and what prevents you from doing that? You mean you'd want to reassign them?

Re: What’s New in Python 3.8

#209

Earlier quoted context omitted.

just use "_P", a fairly-widely-recognized substitute from the Lisp world.

As a python programmer I would have no idea what `valid_P` is supposed to mean. Valid Pascals?

P is shaped like a question mark, though I think it was retronymed to stand for "Predicate"

Re: What’s New in Python 3.8

#210
post #69
post #22

As a developer who has primarily developed applications in Python for his entire professional career, I can't say I'm especially excited about any of the "headlining" features of 3.8. The "walrus operator" will occasionally be useful, but I doubt I will find many effective uses for it. Same with the forced positional/keyword arguments and the "self-documenting" f-string expressions. Even when they have a use, it's us…

> The "walrus operator" will occasionally be useful, but I doubt I will find many effective uses for it. The primary one I want is if m := re.match(...): print(m.group(1)) and while s := network_service.read(): process(s) both of which are both clearer and less error-prone than their non-walrus variants. The other one that I would have found useful an hour ago is in interactive exploration with comprehensions. I freq…

I think there are a lot of use-cases for some kind of dedicated "if-with-outputs" syntax, where you have some extra variables available inside the if-block if the condition matched. Such a syntax could cover a lot of the problems of double execution but also prevent hard to understand code like the walrus operator.

... I've got no idea how the syntax could look though.

Post reply on HN