14 ms·
Python 3.6.0 released
- mjhea0 10y agomajor new features in the release: https://www.reddit.com/r/Python/comments/5jwf41/python_360_has_now_been_officially_released/dbjhh0p/ https://www.reddit.com/r/Python/comments/5jwf41/python_360_h...
- gigatexal 10y agoThis is very exciting. Python got me into programming. So I watch its development very closely.
- tomhoward 10y agoRelated discussion from a few weeks ago: https://news.ycombinator.com/item?id=13123156 https://news.ycombinator.com/item?id=13123156
- jkbr 10y agoWhat's new in Python 3.6.0: https://docs.python.org/3.6/whatsnew/3.6.html https://docs.python.org/3.6/whatsnew/3.6.html
- happy-go-lucky 10y ago> PEP 515 adds the ability to use underscores in numeric literals for improved readability. For example: >>> 1_000_000_000_000_000 1000000000000000 >>> 0x_FF_FF_FF_FF 4294967295 > Single underscores are allowed between digits and after any base specifier. Leading, trailing, or multiple underscores in a row are not allowed.
- Qantourisc 10y agoEvery language should have this.
- dbcurtis 10y agoI totally agree with you. But that opinion reflects two kinds of programming that make up 75% of what I do -- either close to the metal, or comms protocol implementations. I was at PyCON 2016 when Guido was reading off the list of 3.6 new features. In a room full of many 100's of people, I was the only one (that I could hear) applauding for underscores. Guido himself was very dismissive of the feature and it was clear he thought it pointless, but OTOH harmless so why not let it in. I suspect there is a strong correlation between programmers that want underscores in numeric literals, and programmers that live and breath hex.
- simonh 10y agoNice. I really like the look of f-strings as well. All the power of str.format() with none of the verbosity. >>> name = "Fred" >>> f"He said his name is {name}." 'He said his name is Fred.'
- happy-go-lucky 10y agoIt's getting better with each release :)
- hyperbovine 10y agoSurprisingly these are very controversial. A bunch of people seem to hate them. I don't understand why.
- masklinn 10y agoI dislike them because not only are they one more string-formatting method (they're similar to but not actually identical to format-strings as you can use arbitrary expressions in f-string placeholders) and more importantly they're the first one which does not work at all for i18n or more generally for deferred interpolation (which is also used by `logging`)
- orf 10y ago> importantly they're the first one which does not work at all for i18n But surely i18n/deferred interpolation is a corner case, not the norm. If you need that then use what you are currently using, nothings changed.
- JelteF 10y agoNot sure, why you think they cannot be used with defered interpolation. You, can easily combine the two like this: >>> f'{"fstring"} and {{deferred}}'.format(deferred=1234) 'fstring and 1234'
- mixmastamyk 10y agoThere was a large attempt to get i18n/deferred but Guido decided to keep it simple for this release. Perhaps it can be extended in the future. In the meantime i18n uses string.Template.
- deleted 10y ago[deleted]
- fithisux 10y agoI don't do Python, but PEP 515 has got it all wrong.
- petters 10y agoGreat to see even more support for type annotations. Having to specify the type of variables in comments was never a good solution.
- happy-go-lucky 10y agoHere comes type hinting. > PEP 484 introduced the standard for type annotations of function parameters, a.k.a. type hints. This PEP adds syntax to Python for annotating the types of variables including class variables and instance variables: primes: List[int] = [] captain: str # Note: no initial value! class Starship: stats: Dict[str, int] = {}
- hacker_9 10y agoRevolutionary.
- squeaky-clean 10y agoActually type hinting was released with 3.5. I've been using it for a while now, and while there's occasional bugs, I love it (I was able to crash my program at runtime because of a type declaration, which isn't supposed to happen). The difference here is the ability to add type annotations to variables without needing to use a comment to declare it. I'm also pretty excited for the formatted string literals and secrets module! https://docs.python.org/3.6/whatsnew/3.6.html https://docs.python.org/3.6/whatsnew/3.6.html
- happy-go-lucky 10y agoInteresting. https://www.python.org/dev/peps/pep-0484/ https://www.python.org/dev/peps/pep-0484/ > It should also be emphasized that Python will remain a dynamically typed language, and the authors have no desire to ever make type hints mandatory, even by convention.
- squeaky-clean 10y agoYeah, the typing (in theory) makes no actual changes to the runtime code. It's just for linters like mypy to warn you when you write code that goes against your own type declarations. However because it's added directly into your code, it does have a slight runtime effect. Casting types calls a function (which should just be a no-op function), as well as defining TypeVars. The crashes I got at runtime aren't because of the typing module preventing code from running due to types, it was just a bug in the runtime part of typing. I'll try to find the github issue to share, but iirc it was related to using Generics with a TypeVar.
- rcarmo 10y agoHmmm. I'm curious. Alpine Linux 3.5.0 just came out, so I wonder - how long will it take for this to be shipped with the next release? (I maintain https://github.com/rcarmo/alpine-python https://github.com/rcarmo/alpine-python, which saves me hours and hours of deployment time)
- barthalion 10y agoAlpine has (usually) 6 month long development cycles.
- fithisux 10y agoPlease wait until Alpine Linux 3.6.0, Alpine Linux 3.5.0 is better served by Python 3.5.x :-)
- leojg 10y agoAnybody knows what´s the state of python 3 right now? I mean, are there popular libraries and frameworks that still uses python 2? Or this is no longer an issue?
- dwightgunning 10y agoThe amount of pain you'll experience is dependent on your area of work. E.g. web-dev, systems, science. Most certainly use Python3 for any new projects. Here's a quick overview of the most popular PyPI packages and their support for Python 3: http://py3readiness.org/ http://py3readiness.org/
- bendmorris 10y agoMost? Do you have a source for that? As a counterpoint, this JetBrains survey [1] shows only 40% of Python users ever use Python 3. Considering it has been eight years since the initial release, that's a very low share. [1]
- xapata 10y agoSounds like a healthy portion to me in comparison to other major software upgrades. The original expectation was about 5 years before the shift started. Seems like we're mildly behind the expected schedule. After it was released, it'd be only the early adopters for a couple years, then the major libraries would follow a few years after. After 5ish years, the big libraries were ported and the second wave of early adopters could shift over. Now we'll start seeing major enterprises make the move over the next few years. Facebook already made the change, but they're tech-forward. How many people use old versions of RHEL? Of Windows?
- bendmorris 10y ago(missed the survey link: https://www.jetbrains.com/pycharm/python-developers-survey-2016/ https://www.jetbrains.com/pycharm/python-developers-survey-2...)
- epoch1970 10y ago
- orblivion 10y agoI was wondering how the new `datetime.fold` attribute would avoid breaking old code. From looking at the full PEP, it appears that there are new fold-aware tzdatas that you have to choose to use.
- __s 10y agoI'd like to credit abarnert for starting the wordcode changes: https://github.com/abarnert/cpython/tree/wpy https://github.com/abarnert/cpython/tree/wpy We were discussing for a bit & then he went silent. Haven't heard from him since I kind of stepped in, rewrote the peepholer, & then initiated the python dev discussion earlier than he wanted to. He wanted to develop the idea & benchmark it in a bubble, whereas I really felt that this should be developed with feedback from core Python developers. Serhiy was very patient with me, there was a lot of feedback it turns out Fun little issue that thankfully got caught last month: http://bugs.python.org/issue28782 http://bugs.python.org/issue28782 (I had thought about this error case, but at the time I had lasti being -2 & the first byte of the bytecode is never 72. I forgot this constraint when having lasti be -1 still)
- SloopJon 10y agoThe bytecode interpreter I test has over a thousand instructions, because much of the standard library functions are baked in. I asked a colleague whether it made sense to convert to wordcode. He thought it might: simpler decoding, less branching, and easier alignment. I think code size would go up, but not by much. Really interesting to see this come to Python. Thanks for mentioning it.
- sandGorgon 10y agoI didn't know what you meant...until I saw this The Python interpreter now uses a 16-bit wordcode instead of bytecode which made a number of opcode optimizations possible. (Contributed by Demur Rumed with input and reviews from Serhiy Storchaka and Victor Stinner in issue 26647 and issue 28050.)
- ruda 10y agoThe most interesting parts are PYTHONMALLOC and Probes (DTrace and SystemTap). Profiling and debugging are very important in production.
- gregn610 10y agodo async comprehensions ( https://www.python.org/dev/peps/pep-0530/#asynchronous-comprehensions https://www.python.org/dev/peps/pep-0530/#asynchronous-compr... ) give you concurrency? Or are they a building block to getting that in the future?
- RedCrowbar 10y agoYes, async comprehensions are concurrent like all other async mechanisms in Python 3 are. But you are likely thinking about parallelism, not concurrency, in which case the answer is also yes, if you use thread or process executors for tasks.
- dbcurtis 10y agoasync in general gets you concurrency. async def/await is syntactic sugar around generators built with __iter__ and __next__. It is totally possible to do cooperative multitasking with __iter__, __next__, yield, yield from. What this is doing is painting in some of the missing corners of the syntax. Anything you can do with a list comprehension can be done with a for loop, less tersely, often but not always less readably (choose wisely). This new syntax allows you to write comprehensions with asynchronous behavior that in 3.5 and earlier requires you to write a loop. Progress is in the eye of the beholder. "Code is read more often than it is written." Please chose the most readable form.
- jjawssd 10y agoHow can I install this (3.6.0) using Homebrew (brew.sh) alongside Python 3.5.2? (Not replacing it)
- rbanffy 10y agoI'd go with https://github.com/collective/buildout.python https://github.com/collective/buildout.python or with Macports. Eventually someone will have it for Homebrew.
- ruiseal 10y agoI would uninstall the homebrew Python versions and instead install pyenv [1], via homebrew, and then install whatever Python versions you want. They will run happily side-by-side. [1]: https://github.com/yyuu/pyenv https://github.com/yyuu/pyenv
- jjawssd 10y agoWow I can't believe I didn't find this earlier! Well-organized virtual environments AND python versions. Simply amazing! "brew install pyenv-virtualenv" has me up and running with everything I ever wanted in one line
- wiz21c 10y agoIt has not been done yet so I need to : forget Python 3, nobody uses it, python 2.7 is the one and only :-)
- chrisshroba 10y agoI absolutely LOVE format strings. Whereas before, you had to format strings in one of these ways (among other more verbose ways): "My name is {} and I am {} years old".format(name, age) "My name is %s and I am %s years old" % (name, age) "My name is {name} and I am {age} years old".format(name=name, age=age) Now, we can finally use f-strings, where anything in brackets is eval'ed, with the result subbed in: f"My name is {name} and I am {age} years old."
- sakubara 10y agoI can imagine this to be especially useful in implementing __repr__ and __str__ for classes.
- kbutler 10y agoBut I really miss "There should be one-- and preferably only one --obvious way to do it." (Conflict between improvement and backward compatibility, but I miss it.)
- bbatha 10y agoThe quote in context shows no conflict: In the face of ambiguity, refuse the temptation to guess. There should be one-- and preferably only one --obvious way to do it. Although that way may not be obvious at first unless you're Dutch. It pretty clear that if you support python 3.6 you should use `f` strings.
- kbutler 10y ago> It pretty clear that if you support python 3.6 you should use `f` strings. And if you support any earlier version of python, you cannot use f strings. Hence, there is a conflict between improvement and backward compatibility.
- ghshephard 10y agoBut for new projects, where you can chose the version of Python you want, there is no requirement for "backwards compatibility" - it's not as though Python 3.6 isn't available for every platform that 3.5 was on.
- spraak 10y agoI recently started learning Python for using some machine learning libraries. Professionally I mostly do Javascript (and a tiny bit of Go). Javascript is often bashed for it's nonsensical choices.. but I actually find the latest version of JS quite eloquent, most especially compared to Python.
- actuallyalys 10y agoCan you name specific areas you think are better? (I'm not challenging your statement; I'm just curious.)
- zo7 10y agoAre there any breaking or behavioral changes in this from 3.5? I'd love to start using some of the new async features.
- nhumrich 10y agoThere aren't any breaking changes from 3.5 The only behavioral change is that dictionaries now maintain insertion order. But that likely won't break anything.
- MrBingley 10y agoDang, tau (τ = 2π), was added to the math module. I like tau, but I thought for sure that wouldn't actually get accepted. Issue 12345 - https://bugs.python.org/issue12345 https://bugs.python.org/issue12345 PEP 628 - https://www.python.org/dev/peps/pep-0628/ https://www.python.org/dev/peps/pep-0628/
- mixmastamyk 10y agoWhy dang if you like it?
- kirkdouglas 10y agoDoes anyone know dev team plans for version 3.7?
- deleted 10y ago[deleted]