Live data from Hacker News

Python 3.8.0a1 is now available for testing

pythoninsider.blogspot.com

1–10 of 59 posts

Re: Python 3.8.0a1 is now available for testing

#2
Notably new is the assignment expressions [1]. This was quite controversial and the battle around it caused Guido to step down as BDFL [2].

I personally think it's quite a nifty feature. I often end up writing something along the lines of:

    result = do_something()
    if result:
        do_more(result)
Now that can be expressed as:

    if result := do_something():
        do_more(result)
It definitely has the potential to be abused and reduce readability, but applied well I think it can increase readability.

[1] https://www.python.org/dev/peps/pep-0572/#relative-precedenc... [2] https://mail.python.org/pipermail/python-committers/2018-Jul...

Re: Python 3.8.0a1 is now available for testing

#3
The key changes seem to be [PEP-572], a bunch of small backward-compatible syntax changes, a bunch of AST (internal) changes, and bugfixes (of course).

  # You can now write
  if (match := pattern.search(data)) is not None:
    # Do something with match
  # or even
  [y for x in data if (y := f(x)) is not None]
This is what I personally very much anticipated.

Also nice:

  # This is now supported.
  x: Tuple[int, int] = 1, 2  # No parens.
  yield 1, 2, 3, *rest  # No parens again.
[PEP-572]: https://www.python.org/dev/peps/pep-0572/

Re: Python 3.8.0a1 is now available for testing

#4
post #2

Notably new is the assignment expressions [1]. This was quite controversial and the battle around it caused Guido to step down as BDFL [2]. I personally think it's quite a nifty feature. I often end up writing something along the lines of: result = do_something() if result: do_more(result) Now that can be expressed as: if result := do_something(): do_more(result) It definitely has the potential to be abused and reduc…

It is definitely useful, but it severely reduces readability in my opinion. Your example is also a great example for this. The first version in way more readable than the second version with the walrus operator.

Re: Python 3.8.0a1 is now available for testing

#5
post #4
post #2

Notably new is the assignment expressions [1]. This was quite controversial and the battle around it caused Guido to step down as BDFL [2]. I personally think it's quite a nifty feature. I often end up writing something along the lines of: result = do_something() if result: do_more(result) Now that can be expressed as: if result := do_something(): do_more(result) It definitely has the potential to be abused and reduc…

It is definitely useful, but it severely reduces readability in my opinion. Your example is also a great example for this. The first version in way more readable than the second version with the walrus operator.

I agree with you.

It's very exciting to remove these sorts of redundant lines, but I cannot train my brain to intuitively view that line as it will be interpreted.

There is one case where the benefit, IMHO, far outweighs the negatives, and that can be seen in slides 30-31 of Dustin Ingram's slideshow[1].

PEP 572... the day Python jumped the walrus.

1. https://speakerdeck.com/di_codes/pep-572-the-walrus-operator...

Re: Python 3.8.0a1 is now available for testing

#6
post #2

Notably new is the assignment expressions [1]. This was quite controversial and the battle around it caused Guido to step down as BDFL [2]. I personally think it's quite a nifty feature. I often end up writing something along the lines of: result = do_something() if result: do_more(result) Now that can be expressed as: if result := do_something(): do_more(result) It definitely has the potential to be abused and reduc…

I am already disappointed in post-Guido Python. Although the walrus operator makes enough sense to me, it doesn’t solve anything that I consider a problem so I can’t reason that it was worth going against so much pushback.

Re: Python 3.8.0a1 is now available for testing

#7
post #2

Notably new is the assignment expressions [1]. This was quite controversial and the battle around it caused Guido to step down as BDFL [2]. I personally think it's quite a nifty feature. I often end up writing something along the lines of: result = do_something() if result: do_more(result) Now that can be expressed as: if result := do_something(): do_more(result) It definitely has the potential to be abused and reduc…

It is a nifty feature. However a lot of us wanted it to use the "as" keyword (like in SQL and Python) instead of more colons, which are multiplying.

Unfortunately "as …" had a few drawbacks in rare use cases (:= has only aesthetic drawbacks), but I think as was by far the most consistent, readable choice and supported ~90% of use cases.

As for the controversy, that's what happens when you reverse 25 year-old design decisions. Shouldn't be too surprising.

Re: Python 3.8.0a1 is now available for testing

#8
post #3

The key changes seem to be [PEP-572], a bunch of small backward-compatible syntax changes, a bunch of AST (internal) changes, and bugfixes (of course). # You can now write if (match := pattern.search(data)) is not None: # Do something with match # or even [y for x in data if (y := f(x)) is not None] This is what I personally very much anticipated. Also nice: # This is now supported. x: Tuple[int, int] = 1, 2 # No par…

That list comprehension is the most compelling case I've seen for this functionality; far more so than the basic assignment + if.

Re: Python 3.8.0a1 is now available for testing

#9
There were notable performance improvments with several positional argument only functions made 1.3-1.7x faster in stdlib https://bugs.python.org/issue35582.

namedtuple attr access is also now 1.7x faster https://github.com/python/cpython/pull/10495

Other performance improvments : https://github.com/python/cpython/pulls?q=is%3Apr+sort%3Aupd...

Re: Python 3.8.0a1 is now available for testing

#10
post #2

Notably new is the assignment expressions [1]. This was quite controversial and the battle around it caused Guido to step down as BDFL [2]. I personally think it's quite a nifty feature. I often end up writing something along the lines of: result = do_something() if result: do_more(result) Now that can be expressed as: if result := do_something(): do_more(result) It definitely has the potential to be abused and reduc…

[deleted]
Post reply on HN