Earlier quoted context omitted.
I for one predict that the new operator will appear very sparingly, in while loops and code golf competitions. There are already so many complicated semantics about mutability, iteration, bytes/strings, scoping, et al. And yet somehow a tiny piece of syntax that finally lets us stop writing "while true/break" is the big pain point?
Excess complexity almost always comes in small increments...
What's Coming in Python 3.8
251–260 of 558 posts
Re: What's Coming in Python 3.8
#252The problem with modern Python is that it's trying to recreate C# or Java. Which leaves it with nothing, because it'll only end up an inferior version of the languages/platforms of which it's attempting to duplicate. When I was into Python, I liked it because it was a tighter, more to the basics language. Not having 4 ways to format strings and so forth. I don't think Python can defeat Java by becoming Java. It'll lo…
Also, this motto should be interpreted in the appropriate historical context – as taking a position in relation to that of Perl, which was dominant when Python was gaining popularity and had the motto "there's more than one way to do it".
Re: What's Coming in Python 3.8
#253Earlier quoted context omitted.
Disable it in pylintrc. Pylint is unusable without a good config file anyway.
Ideally the defaults should be sensible. I have found they mostly are, except the f-string one.
$ pylint pylint_sucks_at_partials.py
************* Module pylint_sucks_at_partials
pylint_sucks_at_partials.py:7:0: C0103: Constant name
"add5" doesn't conform to UPPER_CASE naming style
(invalid-name)
The program in question: #!/usr/bin/env python
""" proving pylint still sucks at partials """
from functools import partial
from operator import add
add5 = partial(add, 5)
if __name__ == '__main__':
import sys
print(add5(int(sys.argv[1])))Re: What's Coming in Python 3.8
#254The abbreviated f-string syntax looks weird and kinda wrong to me. But then I'm not even sure I've got comfortable yet with the object field initialization shortcuts in Javascript and Rust (where you also get to omit stuff to avoid repeating yourself).
Re: What's Coming in Python 3.8
#255Earlier quoted context omitted.
But now there are two ways to do assignment. That's not very pythonic, is it?
I never felt like there was only one way to do something in Python. Every Stack Overflow question has a multitude of answers ranging from imperative to functional style and with various benefits and drawbacks. Python is one of the least "only one way to do things" languages I've used. This even extends to its packaging system, where you can choose between virtualenv, pipenv, pyenv, etc. Same goes for the installation…
for html_element in iter(scrape_element, None):
this calls scrape_element() until it returns None, returning each value.Re: What's Coming in Python 3.8
#256Earlier quoted context omitted.
My metric for this is to put some of my freshest student in front of a code and see how they deal with it. How easily can they understand it ? How easily can they write it ? Debug it ? They are most of the time a fantastic indicator of the cognitive load a feature will add in prod. Because of course a feature doesn't exist in a vacuum, it's always in a more complex context. So what's easy to understand for a student…
I for one predict that the new operator will appear very sparingly, in while loops and code golf competitions. There are already so many complicated semantics about mutability, iteration, bytes/strings, scoping, et al. And yet somehow a tiny piece of syntax that finally lets us stop writing "while true/break" is the big pain point?
Re: What's Coming in Python 3.8
#257Python 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.
This is what happens when you lose a BDFL. While things become more "democratic", you lose the vision and start trying to make everyone happy.
Re: What's Coming in Python 3.8
#258Re: What's Coming in Python 3.8
#259Re: What's Coming in Python 3.8
#260Earlier quoted context omitted.
Was the controversy really about the need for the feature? I thought most people agreed it was a great feature to have, and most of the arguments were about `:=` vs re-using `as` for the operator.
I like "as" instead. I didn't realize that was on the table. To me, it seems more Pythonic given the typical English-like Python syntax of "with open(path) as file", "for element in items if element not in things", etc.