Live data from Hacker News

What's Coming in Python 3.8

lwn.net

291–300 of 558 posts

Re: What's Coming in Python 3.8

#291

All I care about is allowing a print statement in addition to the print function. There's no technical reason why both can't coexist in a perfectly usable manner.

Try an editor snippet like I did years ago. It's even shorter to type:

    pr  -->  print(" ")
                  #      ^ cursor

Re: What's Coming in Python 3.8

#292
post #62

Earlier quoted context omitted.

But now there are two ways to do assignment. That's not very pythonic, is it?

Assignment can be confusing already. >>> locals()['a'] = 1 >>> a 1 If anything, the walrus operator allows for tightly-scoped assignment, which is good in my opinion.

You don't even need the locals() function to get into trouble:

    x = [1, 2, 3, 4]
    def foo():
        x[0] += 3  # Okay
    def bar():
        x += [3]   # UnboundLocalError
    def qux():
        x = [5, 6, 7, 8]  # Binds a new `x`.

Re: What's Coming in Python 3.8

#293

Earlier quoted context omitted.

I don't think it's just >35-year-olds who find what's going on in Python against the natural order of things?

I'm 34 and I don't like this, so it's definitely not only those above 35. Jokes aside, I would say I'm a minimalist and this is where my resistance comes from. One of the things that I dislike the most in programming is feature creep. I prefer smaller languages. I like the idea of having a more minimal feature set that doesn't change very much. In a language with less features, you might have to write slightly more c…

> In a language with less features, you might have to write slightly more code, but the code you write will be more readable to everyone else.

I disagree with this, which is precisely why I prefer feature rich languages like Java or better yet Kotlin. It doesn't get much more readable than something like:

  users.asSequence()
    .filter { it.lastName.startsWith("S") }
    .sortedBy { it.lastName }
    .take(3)
Now try writing that in Go or Python and compare the readability.

Re: What's Coming in Python 3.8

#294
post #24
post #8

Python looks more and more foreign with each release. I'm not sure what happened after 3.3 but it seems like the whole philosophy of "pythonic", emphasizing simplicity, readability and "only one straightforward way to do it" is rapidly disappearing.

“I've come up with a set of rules that describe our reactions to technologies: 1. Anything that is in the world when you’re born is normal and ordinary and is just a natural part of the way the world works. 2. Anything that's invented between when you’re fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. 3. Anything invented after you're thirty-five is against the n…

Forewarned is forearmed. I headed into adulthood watching out for such mirages. For example: Making sure to listen to pop music enough that it does exactly what pop music is supposed to do (worm its way into your subconscious) so I don't wake up one morning unaccountably believing that Kylie Minogue was good but Taylor Swift isn't.

My understanding of Python will probably never be quite as good as my understanding of C, but I can live with that.

Re: What's Coming in Python 3.8

#295

I long for a language which has a basic featureset, and then "freezes", and no longer adds any more language features. You may continue working on the standard library, optimizing, etc. Just no new language features. In my opinion, someone should be able to learn all of a language in a few days, including every corner case and oddity, and then understand any code. If new language features get added over time, eventua…

That's what Go has been so far but it might see some changes soon after being "frozen" for ~10 years.

Re: What's Coming in Python 3.8

#296

Earlier quoted context omitted.

I'm working on a language with a focus on simplicity and "only one way to do it": https://vlang.io The development has been going quite well: https://github.com/vlang/v/blob/master/CHANGELOG.md

This is great! Thanks for your work. Can V be integrated into existing c++ projects? I work in audio and constantly working in c++ is tiring. I'd love to work in something like V and transpile down.

Thanks! Absolutely. Calling V code is as simple as calling C (V can emit C).

Re: What's Coming in Python 3.8

#297
post #177

Earlier quoted context omitted.

It's not always a nanosecond, some string representations can take a while to create. In poorly coded Django models they could involve a trip to the database.

if logger.isEnabledFor(logging.DEBUG): logger.debug(f'{expensive_func()}')

I hope that’s a joke, because that is a verbose and ridiculous way of duplicating the work that the logging module does, while also making the code less readable and maintainable!

Re: What's Coming in Python 3.8

#299
post #278

Earlier quoted context omitted.

I envisioned it like "if/else" or "for/else" or "while/else", where a "do" block must be followed by a "while" block. x = 0 do: x += 1 while: x

This completely contradicts the rest of Python grammar, and indeed many languages’ grammars. The consistent way would then be `while x < 10` but that too looks ridiculous. The issue is that you can’t have post-clause syntax in Python due to its infamous spacing-is-syntax idea.

Why does `while x < 10` look ridiculous? It looks exactly like the syntax for regular while loops, just in this case it's after a `do:` block. And the example above yours looks like try/catch syntax, but tbh I like the one you suggested a bit more.

Re: What's Coming in Python 3.8

#300
post #62

Earlier quoted context omitted.

I see what you're saying, but I kinda like the gets ":=" operator.

But now there are two ways to do assignment. That's not very pythonic, is it?

I can think of more than two ways to do a lot of things in Python. Besides the ":=" doesn't work exactly the same.

Also, I can't bring myself to call it the walrus operator. Sorry, guys. I had a Pascal teacher ages ago who pronounced it "gets" and that has always stuck.

Post reply on HN