My experience: I've tried Python 3 and enjoy it very much. A few things drove me nuts at first, trying to figure out why syntax that worked in Python2 is not longer working in Python3. But a little bit of googling and I was on my way with Python3. I have a project that I started a long time ago in Python2 using web.py. I tried to migrate to Python3, but unfortunately, web.py is not supported. I know Flask has python3…
Python 3.5.0
121–130 of 165 posts
Re: Python 3.5.0
#122Earlier quoted context omitted.
> When I have to write code in 2.7 now, it feels like shifting from fifth gear down to second. You mean, second gear up to fifth? I tried writing some Python 3 code and the lack of parameter tuple unpacking by itself stunned me and drove me crazy, never mind other stuff. Python 3 seems very user-unfriendly compared to Python 2. Won't touch it with a ten foot pole unless my life depends on it.
I've been using Python for 7+ years, and I had no idea parameter tuple unpacking was a thing. Never once seen any code that uses it, or seen anyone mention it. If you think the (rightful) removal of a hardly used feature[1] that has some big problems is a blocking issue then I feel sorry for you. Py3 is awesome. 1. https://www.python.org/dev/peps/pep-3113/
Re: Python 3.5.0
#123Re: Python 3.5.0
#124Earlier quoted context omitted.
in this case, how are most of you guys writing code with asyncio ? or is there any code being written at all. Right now, it seems to me that Python 3.5 is not ready for adoption since it is not usable with any framework at all. I mean, I really want to use asyncio, but 99% of python mindshare is around SqlAlchemy, Bottle, Flask, Django and Cherrypy. and I cant use it with any of them. aiohttp looks cool, but I would…
You can definitely use asyncio with CherryPy: http://ws4py.readthedocs.org/en/latest/sources/servertutoria...
Re: Python 3.5.0
#125Earlier quoted context omitted.
Care to share some highlights? Fifth to second sounds like a big difference!
It has the ability to statically check the type system , that's amazing. Moreover async/await with async resource management (which C# doesn't have yet) gives it a real edge for server development.
I was under the impression that type checking was not one of the goals of PEP 484 etc.
Re: Python 3.5.0
#126Earlier quoted context omitted.
I've been using Python for 7+ years, and I had no idea parameter tuple unpacking was a thing. Never once seen any code that uses it, or seen anyone mention it. If you think the (rightful) removal of a hardly used feature[1] that has some big problems is a blocking issue then I feel sorry for you. Py3 is awesome. 1. https://www.python.org/dev/peps/pep-3113/
Interesting. Javascript is actually adding something very similar, calling it destructuring. It's actually quite handy - although admittedly more handy for destructuring object arguments than array arguments.
def fxn(a, (b, c), d):
pass
Be a valid function signature. So the destructuring is held in the function definition.Python 3 will still allow
def fxn(a, x, d):
(b, c) = x
pass
Both Python and ES6 JavaScript allow destructuring arrays://javascript
let [x, y] = [1,2]
#python
[x, y] = [1,2]
(x, y) = (1,2)
Re: Python 3.5.0
#127Python somehow always manages to miss the mark. The new co-routine stuff is a good example. Who can explain to me how I return more than once from the same co-routine? That is what a co-routine is after all no?
Check any tutorial about it or even the relevant pep. It's explained in many places. In short: def some_co(): yield 2 yield 3
It is a SyntaxError to have yield or yield from expressions in an async function.
That's what I mean when I say it misses the mark. There are now two ways of doing the same thing and one of them is more powerful than the other. Using generators I can use both `yield` and `yield from` but if I use what they're calling co-routines then I can only use `yield from`. I see no value in the new syntax.So an async function is not really a co-routine. It is a regular function that gets to use `await` and that's it. Calling it a co-routine is misleading and confusing.
Re: Python 3.5.0
#128Earlier quoted context omitted.
As someone who's bounced back and forth between Python 2 and Python 3, I'm curious about your need of parameter tuple unpacking[0]. I've never encountered it, and after some research I don't understand the use case. I don't mean to sound like I'm trying to belittle your position, I would like to understand more. The PEP below doesn't seem to do a very good job explaining why people like them, and I'd like to hear a p…
I use it like es6 or haskell destructuring. Sure it's a little weak compared to both those implementations, but the tuple case covers enough to be useful.
Re: Python 3.5.0
#129Earlier quoted context omitted.
Interesting. Javascript is actually adding something very similar, calling it destructuring. It's actually quite handy - although admittedly more handy for destructuring object arguments than array arguments.
Python 2 & 3 have destructuring. This is talking about having def fxn(a, (b, c), d): pass Be a valid function signature. So the destructuring is held in the function definition. Python 3 will still allow def fxn(a, x, d): (b, c) = x pass Both Python and ES6 JavaScript allow destructuring arrays: //javascript let [x, y] = [1,2] #python [x, y] = [1,2] (x, y) = (1,2)
function fxn(a, [b, c], d) {
console.log(a, b, c, d);
}Re: Python 3.5.0
#130Could someone explain how to properly install Python 3.5.0 on Ubuntu so that it replaces the system's default Python 3.4.0 as the new default? Installing is the easy part, but I haven't figured out how to also make sure all the libraries that come with Python are also replaced with the 3.5 versions. Thanks!
I think the only correct way to do this is via 'apt-get upgrade'. In other words, you probably don't want to replace the system Python manually, because a lot of utilities depend on it, and you might bork your system. Using virtualenv is the generally-recommended way to run a different version.
$ head -1 /usr/bin/lsb_release
#! /usr/bin/python3 -Es
Obviously, all utilities should do this, and should probably be more specific than that. Distros could have a tool to patch this automatically, and then they wouldn't break when the user chooses to upgrade system python.