Live data from Hacker News

Python 3.5.0

python.org

41–50 of 165 posts

Re: Python 3.5.0

#41
I've recently joined a Python project, my first time working with the language. We're currently using Python 2.7. How do experienced Pythonistas decide if/when to upgrade to 3.x? I figured it was a no brainer given that it has been 7 years with a number of big releases, but Flask's warning on this topic put me off:

http://flask.pocoo.org/docs/0.10/python3/

Re: Python 3.5.0

#43
post #41

I've recently joined a Python project, my first time working with the language. We're currently using Python 2.7. How do experienced Pythonistas decide if/when to upgrade to 3.x? I figured it was a no brainer given that it has been 7 years with a number of big releases, but Flask's warning on this topic put me off: http://flask.pocoo.org/docs/0.10/python3/

IMHO the only reason to use 2.x for new projects is if a necessary dependency doesn't exist for 3 yet.

Sadly the situation for using asyncio for web was not that great last I checked, because that would be a strong incentive.

Re: Python 3.5.0

#44
post #16

PEP 0448 in addition to already implemented PEP 3132 make it very tempting to switch. If PEP 0448 had unpacking in comprehensions I'd switch. (Doesn't seem be a follow-up PEP just for that functionality yet.) https://www.python.org/dev/peps/pep-0448/ https://www.python.org/dev/peps/pep-3132/ I'd be really nice to use this. >>> [*range(i) for i in range(5)] Instead of this monstrosity right now. >>> [x for y in (range…

> Also, I like print.

That really bugged me for a while, but then I added a "snippet" into my editor. Now I type: pr then the tab-key, and it transforms to:

    print('', )  # with cursor between quotes
and it works well, also I have similar shortcuts for logging.

Re: Python 3.5.0

#45
post #41

I've recently joined a Python project, my first time working with the language. We're currently using Python 2.7. How do experienced Pythonistas decide if/when to upgrade to 3.x? I figured it was a no brainer given that it has been 7 years with a number of big releases, but Flask's warning on this topic put me off: http://flask.pocoo.org/docs/0.10/python3/

Those flask docs look out of date. I don't think you'll hit those troubles in python 3 anymore. It's imo a very mature ecosystem now.

Re: Python 3.5.0

#46
Could 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!

Re: Python 3.5.0

#47
post #16

PEP 0448 in addition to already implemented PEP 3132 make it very tempting to switch. If PEP 0448 had unpacking in comprehensions I'd switch. (Doesn't seem be a follow-up PEP just for that functionality yet.) https://www.python.org/dev/peps/pep-0448/ https://www.python.org/dev/peps/pep-3132/ I'd be really nice to use this. >>> [*range(i) for i in range(5)] Instead of this monstrosity right now. >>> [x for y in (range…

> Such as filter keeping the type. In 3 it returns an iterator. > >>> filter(lambda x: x in 'ABC', 'ABCDEFA') > 'ABCA' it was a special case for a few types, didn't (couldn't) work for all types e.g. >>> filter(lambda x: x in 'ABC', set('ABC')) ['A', 'C', 'B'] > Also, I like print. I like Python 3's print. It's kind-of a pain because my day-to-day uses Python 2 and the context switch is annoying, but 3's is way more…

In case you haven't seen it, in Python 2.7:

  >>> from __future__ import print_function
  >>> print("hi")
  hi
  >>>
My team is starting to use it as we look to migrate various command line utilities to python 3.

Re: Python 3.5.0

#48
post #18
post #8

Earlier quoted context omitted.

Agreed but does this apply in Numpy as well? Will Python matrix multiplications just work on lists of lists in which case they're much slower? Sorry just asking from a 2.7 holdout here as this might cause me to move.

From: http://legacy.python.org/dev/peps/pep-0465/#id24 Implementing __matmul__, __rmatmul__ and __imatmul__ will allow you to apply this operator to any given class. In that light, you could subclass the numpy matrix class yourself and simply apply these. As for whether these will be applied to Python lists, my speculation is: I doubt it. Its possibly the most commonly used data structure, and I doubt they would add…

> Its possibly the most commonly used data structure, and I doubt they would add the overhead of another set of methods on each instance.

Unless I'm grossly mistaken, Python methods add basically no per-instance overhead (they add per-class overhead.)

Re: Python 3.5.0

#49

Question - is there any web/api framework that leverages asyncio ? This implicitly also means first class DB/ORM support. Flask, sqlalchemy ,etc seem to be using gevent and py 2.7.

I'm not sure, but perhaps aiohttp[1] fits the bill? Not sure if there's a "full" framework that does everything, but take a look at the simple benchmark code:

https://github.com/klen/py-frameworks-bench/blob/develop/fra...

(from: http://klen.github.io/py-frameworks-bench/)

[1] http://aiohttp.readthedocs.org/en/stable/

Re: Python 3.5.0

#50

The scandir update also changes the underlying implementation of os.walk giving loads of production apps a huge speed increase by making use of additional data returned by the os calls.

Could os.walk have been changed "under the hood" without a PEP? eg. using — just for example — fast_walk_in_c in _os.so

(I understand that adding os.scandir might require a PEP)

Post reply on HN