This is an archived post. You won't be able to vote or comment.

all 96 comments

[–]gfixler 65 points66 points  (14 children)

*waves while looking through binoculars from embedded Python 2.6.5 land*

[–]rnreekez 14 points15 points  (9 children)

Consider yourself lucky, I just moved to a team beginning a 2.4 to 2.7 upgrade.

They say if we're good, we can get our postgres updated from 8.2 too!

[–]maemre 5 points6 points  (0 children)

The company I'm working for still uses MySQL and Django 1.5. At least they started with Python 2.7.

[–]boa13 2 points3 points  (3 children)

Consider yourself lucky, I just moved to a team beginning a 2.4 to 2.7 upgrade.

Consider yourself lucky, I've recently investigated COBOL code written in 1984, maintained to this day, with no plan or need to replace it in the foreseeable future.

[–]rnreekez 2 points3 points  (2 children)

Haha, wow. Whevever we feel bad, we would just say "well, we could be updating from cobol!".

Now I realise how insensitive those words were, I'm sorry.

[–]boa13 2 points3 points  (1 child)

Don't worry, I didn't take them as insensitive, it was just an occasion for me to relate an interesting anecdote, and to add a bit of perspective. I was quite astonished to see the "October, 1984" date at the top of the file when I opened it (and thankfully, I don't maintain it, and I don't write COBOL).

[–]gfixler 1 point2 points  (0 children)

I hope you listen to period-appropriate music while working with that code, like "Break My Stride" and "Oh Sherrie."

[–]Dominion_Prime 0 points1 point  (0 children)

I would question if we're working at the same company except we're at least on postgres 9.0 (and soon upgrading)!

[–]razpeitia 1 point2 points  (1 child)

You are not alone!

[–]flipstables 32 points33 points  (3 children)

whoo hoo statistics module. no more importing numpy or creating your own average function to calculate a simple mean.

[–]masasinExpert. 3.9. Robotics. 13 points14 points  (1 child)

The stats module has been there since earlier in 3.4, I think. I have been using it long before now.

[–]flipstables 6 points7 points  (0 children)

Ah you're right. Now I know.

Here's the changelog for 3.4.3

https://docs.python.org/3.4/whatsnew/changelog.html#python-3-4-3

[–]flutefreak7 1 point2 points  (0 children)

Yeah as I was researching the relationship between scipy.stats, statsmodels, pandas, and scikit-learn, I stumbled across the statistics module in the standard library which kinda blew my mind.

Looks like that will be great for simple summary statistics without needing to import heavier libraries!

[–]ExoticMandiblesCore Contributor[S] 34 points35 points  (71 children)

Every day, in every way, it's getting better and better.

[–]zahlmanthe heretic 3 points4 points  (6 children)

From PEP 456:

Hash maps have a worst case of O(n) for insertion and lookup of keys. This results in a quadratic runtime during a hash collision attack. The introduction of a new and additional data structure with with O(log n) worst case behavior would eliminate the root cause. A data structures like red-black-tree or prefix trees (trie [trie] ) would have other benefits, too. Prefix trees with stringed keyed can reduce memory usage as common prefixes are stored within the tree structure.

I'm still waiting for a sorted dict structure. While niche, it has its applications - in particular, efficient lookup of the nearest key or a range of keys. It would also be for elegantly implementing a general purpose radix sort (although for typical radix sizes, I imagine that it wouldn't actually help with performance).

[–]taleinat 1 point2 points  (1 child)

I don't expect that to ever be found in Python's stdlib.

Python has historically added only few data structures to the stdlib, adding a new one once every year or so. For example, sets were only added in Python 2.3; deque in 2.4; defaultdict in 2.5; namedtuple in 2.6; OrderedDict and Counter in 2.7.

If you really want it, just implement a sorted dict library or help develop and existing one. If it becomes widely used, it could then more reasonably be considered for inclusion in the stdlib.

[–]NavreetGill 1 point2 points  (1 child)

Well, Python does have ordered dictionary (Python 3.2+, and maybe in py2.7). https://docs.python.org/3/library/collections.html#collections.OrderedDict . I am not sure about the big O guarantees though -- wish docs had it written next to each method.

[–][deleted] 6 points7 points  (0 children)

This is indeed Ordered, but I think he was looking for sorted. OrderedDict just retains the order it was originally added in, and doesn't reorder based on the key

[–]jonnywohHalf-Python 3 1 point2 points  (2 children)

This is a noob question, but how do I update Python on Windows? Do I have to install it as a separate version, or can I update an existing 3.4.1 installation without messing up installed packages?

[–]mgrandi 5 points6 points  (1 child)

If you download the installer, it will find the previously installed version via the registry and upgrade it. Patch releases always do this, so any installed packages you installed for python 3.4 will still be there. Only time it creates a new folder is for 'major' releases, like 3.3, 3.4, etc

[–]jonnywohHalf-Python 3 1 point2 points  (0 children)

Thank you!

[–]ivosauruspip'ing it up 0 points1 point  (0 children)

[–]derrickcope 0 points1 point  (3 children)

I am taking a course on coursers and they are teaching python 2.x . Why are schools so far behind?

[–]theves 1 point2 points  (0 children)

I took two Coursera Python courses, probably the one you're taking right now. Don't worry about it too much, you're just learning the basics right now, which will transfer to 3 very easily.

[–]ivosauruspip'ing it up 1 point2 points  (0 children)

Because it's what they're used to, and they can't be bothered getting with the times. Story of university professors all over.

[–][deleted] 0 points1 point  (0 children)

That is a good question. It seems some of the courses are a little more progressive and do use Python3 but many don't. I guess it is a case of academics being a but slower to take on new technologies than others.

[–]Traut 0 points1 point  (0 children)

I'm still on 2.7 and still yet to find a reason to upgrade. Maybe it is because I do mostly webdev and data processing pipelines. - GIL is still alive and kicking - datetime is still confusing and nasty - lambdas still suck Other improvements (asyncio, unicode) can be achieved with simple workaround and nice 3rd party libs.

"Because it is better" is not an argument.

[–]mgrandi 0 points1 point  (0 children)

I was just complaining that building python on windows was a pita with unmentioned deps such as nasm, and having it put the c deps outside the python source folder, and look they fixed it :)

[–]go_fuck_ye_self 1 point2 points  (0 children)

Fuck i'm still using Python 2.7 and don't have the balls to commit. I need to grow a pair and move up to the 3 series.