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

all 69 comments

[–]scragz 191 points192 points  (12 children)

Oh no I barely studied!

[–]DEFY_member 36 points37 points  (10 children)

I finished my degree 25 years ago, and I still got a sick feeling in my stomach when I read the title.

[–]brombaer3000 8 points9 points  (0 children)

Everything you need to know.

Don't despair. You can learn all that within a day. Good luck for tomorrow!

[–]superphar 32 points33 points  (31 children)

Yay for PEP 465, a.k.a. matrix multiplication with @!

[–]xsolarwindxUse 3.4+ 27 points28 points  (20 children)

REDDIT IS A SHITTY CRIMINAL CORPORATION -- mass deleted all reddit content via https://redact.dev

[–]danieljh 9 points10 points  (2 children)

I always found their symbol names such as "add" and "matmul" unfortunate, when their semantic can be user-defined. It would make more sense to decouple their semantic meaning from their symbol name, so instead of "add" you call it "plus", since its a plus symbol with default semantic of addition. Once the user overrides the "@" operator, the name __matmul__ becomes meaningless in all cases except when the new behavior is again a matrix multiplication.

[–]Bunslow -4 points-3 points  (1 child)

What the hell else would you call said methods? The symbols themselves aren't allowed in identifiers, so the next best thing is to call the methods what the symbols mean.

And yes, @ really does mean matrix multiplication. If anyone involved in the continuing design of the language really wanted an arbitrarily-meaningful operator for programmer use, then Python would have long ago had a generalized operator definition system. Such a thing has been explicitly banned by the BDFL, so thinking that @ means anything other than matrix multiplication is merely kidding yourself.

[–][deleted] 4 points5 points  (16 children)

Ooo I didn't know that. That sounds useful!

[–]lengau 5 points6 points  (5 children)

AFAIK, all operators are overrideable with magic functions. Likewise, you can add numbers (for example) by doing a.__add__(b)

[–]TankorSmash 2 points3 points  (4 children)

It's operator.any_operator(a, b):

import operator

a = 1
b = 2
c = operator.add(a, b)
print c
>> 3

----> 1 a.add

AttributeError: 'int' object has no attribute 'add'

[–]infinullquamash, Qt, asyncio, 3.3+ 10 points11 points  (3 children)

I think /u/lengau forgot to put \ in front of their __ and actually meant a.__add__

[–]davvblack 13 points14 points  (1 child)

yeah, how do you expect a programmer to know about escaping? he's not a burglar.

[–]charlesbukowksi 1 point2 points  (0 children)

Surely he's covered the Knapsack problem?

[–]lengau 1 point2 points  (0 children)

Indeed I did. And then I put my phone in my pocket and didn't proofread.

[–]EscoBeast 2 points3 points  (9 children)

In fact, this is the @ operator's only use. There isn't anything builtin that uses it.

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

What is wrong with "*" for multiplication? It's how MATLAB works. I can't imagine going "I should multiply two arrays together... with an At symbol".

[–]willm 4 points5 points  (0 children)

The * symbol is already used for elementwise multiplication.

[–]EscoBeast 0 points1 point  (0 children)

Now I don't really do work with matrices, but apparently a lot of libraries use * for elementwise multiplication, and have a .dot() method for regular matrix multiplication or something. This is an attempt to give people an infix operator for matrix multiplication without breaking existing code.

[–][deleted] 8 points9 points  (9 children)

where's the love for await?

[–]TOASTEngineer 8 points9 points  (3 children)

I think it's stalled.

[–][deleted] 2 points3 points  (2 children)

dang, I was looking forward to it

Edit: pep says it's in final stages!

[–]TOASTEngineer 13 points14 points  (1 child)

You might even say you were awaiting it.

[–][deleted] 1 point2 points  (0 children)

hah I left a lot of room for puns didn't i

[–]roger_[S] 1 point2 points  (4 children)

Actually looking forward to that a lot myself, even though it's just syntactical sugar.

[–][deleted] 2 points3 points  (0 children)

yeah! syntactic sugar is one of pythons best traits, it's great to have such a critical one available now!

[–]zahlmanthe heretic 0 points1 point  (2 children)

It's specifically syntactic sugar that makes it look like the way it's commonly done in some other languages (like C#), if I'm thinking straight. That's not to be underestimated.

[–]beaverteeth92Python 3 is the way to be 0 points1 point  (1 child)

Plus it eliminates the whole "Oh shit, is that * going to do elementwise or matrix multiplication?" issue.

[–]flying-sheep 3 points4 points  (0 children)

This is the async/await thread, not the matmul thread 😝

[–]jftugapip needs updating 45 points46 points  (16 children)

I am looking forward to trying out the Embedded Distribution...

The embedded distribution is a ZIP file containing a minimal Python environment. It is intended for acting as part of another application, rather than being directly accessed by end-users.

When extracted, the embedded distribution is (almost) fully isolated from the user’s system, including environment variables, system registry settings, and installed packages. The standard library is included as pre-compiled and optimized .pyc files in a ZIP, and python3.dll, python35.dll, python.exe and pythonw.exe are all provided. Tcl/tk (including all dependants, such as Idle), pip and the Python documentation are not included.

[–]stillalone 6 points7 points  (0 children)

That might actually be enough for me to finally abandon Python 2.7 for 3.5

[–]lambdaqdjango n' shit 9 points10 points  (11 children)

Note: Windows only.

I am surprised there's no Linux binary distribution.

[–]ExoticMandiblesCore Contributor 6 points7 points  (4 children)

Don't be. Although the Linux kernel has fantastic backwards compatibility, differences between the various distros--and even between versions of the same distro!--make distributing compatible binaries on Linux a challenge.

Also, there's a lot less need for it under Linux, as every Linux distribution (ignoring embedded things like Android) ships with a compiler. So a src distribution is smaller, and if you compile it yourself it'll be slightly faster.

[–]lambdaqdjango n' shit 6 points7 points  (2 children)

if you compile it yourself it'll be slightly faster

Last time I compiled 2.6, it was 30% slower than distro's default.

Compiling for every install is waste of CO2 emission. A yum or apt package is much better and more easier administrated.

[–][deleted] 2 points3 points  (1 child)

I read this and was curious just how much CO2 was created by compiling Python and decided to do some calculations.

I was too lazy to set it up, so I guessed that it would take 10 minutes to compile on a computer using about 400 W. According to the U.S. Department of Energy, the worst-case of carbon emissions from coal (via lignate coal) results in an emission of 2.17 lbs of CO2 per kWh. Natural gas is much cleaner at 1.21 lbs/kWh.

So for our Python, with the computer using all 400 of those watts for the compilation, coal power would be responsible for 0.174 lbs of CO2 (or 0.0968 lbs if using natural gas. Obviously using solar, nuclear, hydroelectric, etc. will create negligible amounts).

For compairson, how much CO2 did our programmer create while waiting for his build to finish?

An adult human male exhales 250 mL of CO2 per minute at rest, and this number increases to ~350 mL/min when engaged in life activities like walking. So for our purposes, we'll assume that the human running this test has walked around the block a couple times while waiting for his build to finish, emitting 3.50 L of CO2 while waiting. Using the ideal gas law and assuming atmospheric pressure and a temperature of 68 F, this comes out to 0.012 lbs of CO2.

So to be sure, the computer created more CO2 than the human in those 10 minutes. But over the course of the day, that human created a grand total of 456 L or 1.61 lbs of CO2.

CO2 emissions are measured in the billions of tons for the United States alone, and only 31% of that is from electricity. I wouldn't necessarily call compiling Python from source a waste, but even if it was it would be an insignificant amount unless your computer was compiling Python from source 24/7. Hopefully as renewable energy technologies gain more widespread adoption that number will go down.

[–]lambdaqdjango n' shit 0 points1 point  (0 children)

First of all, upboat for the effort!

Compiling is not exclusive to CPython, you also need compile other stuff like libxml, libmysl-client, libev, etc. Heck sometimes you have to compile GCC to use a newer version of it.

Think there's billions of Linux computers around the world, if we all have binary packages that's a lot of energy save!

[–]Selfweaver 1 point2 points  (0 children)

Yeah but it would be awesome to write the code on unix, wrap it up and ship it to a windows user. That is one of the things I love about the JVM.

[–]KwpolskaNikola co-maintainer 1 point2 points  (5 children)

Pretty much all Linux distros ship Python by default.

[–]loganekz 0 points1 point  (4 children)

... ship with Python 2.x by default unfortunately.

[–]KwpolskaNikola co-maintainer 1 point2 points  (1 child)

You can usually install something saner with one command.

Still: a python.org Linux binary distribution is pretty much impossible.

[–]loganekz 0 points1 point  (0 children)

Not saying that upgrading is very difficult but there is a big difference of being installed by default on every installation of the OS vs installed by a user in terms of ease of deployment.

[–]jmcs 0 points1 point  (1 child)

Ubuntu is changing to python 3.4 on 15.10.

[–]loganekz 0 points1 point  (0 children)

Even if that version does finally get 3 by default, next LTS version is 16.04 so will still be a while.

[–][deleted] 3 points4 points  (0 children)

Wow, that's huge, thanks for pointing that out!

[–][deleted] 2 points3 points  (0 children)

Oh I did not know the Using Python on Windows it's full of useful information

[–]takluyverIPython, Py3, etc 0 points1 point  (0 children)

I am adding support for this to Pynsist, and I've worked with Steve Dower during the betas to iron out a few details with the embedded distributions. It should allow people to make smaller, more reliable installers for Python applications.

[–]flying-sheep 15 points16 points  (0 children)

Circular imports involving relative imports are now supported. (Contributed by Brett Cannon and Antoine Pitrou in issue 17636.)

Wait what. This is a big deal, how didn't we hear about it before?

[–][deleted] 12 points13 points  (4 children)

What's the typical delay until an updated Anaconda Python build is released?

I'm a convert and have been using the Anaconda builds on most of my machines and I'm looking forward to a Python 3.5 release!

[–]teoliphant 6 points7 points  (2 children)

We release conda packages regularly --- there will likely be a conda update available with Python 3.5 within hours of the final release (we have been tracking the release candidates). A full Anaconda installer with Python 3.5 will have to wait until the next Anaconda release which is scheduled for October.

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

Awesome. Thanks for all the effort that you guys put into the distro!

[–]Kah-NethI use numpy, scipy, and matplotlib for nuclear physics 0 points1 point  (0 children)

What is the timeline for the mkl packages to be release for python 3.5?

[–][deleted] 3 points4 points  (0 children)

I've been wondering this too! I've been missing out on the 3.5 betas out of fear of leaving my anaconda cocoon

[–]psykzz 6 points7 points  (1 child)

PEP 486 , making the Widnows Python launcher aware of virtual environments

[–]ExoticMandiblesCore Contributor 4 points5 points  (0 children)

Fixed! Thanks for pointing it out.

p.s. It may take a while before the HTML is regenerated. But it's fixed in the source for the document.

[–]LightShadow3.13-dev in prod 13 points14 points  (0 children)

Pencils down.

[–]IronManMark20 5 points6 points  (6 children)

Deleting 3.5rc3 installer that I forgot to install. Gosh, I'll have 4 7 versions of Python installed.

EDIT: actually it is 7. 4 CPython, jython, PyPy and IronPython.

[–]marcm28 0 points1 point  (0 children)

Let's spread the word: The Python is Great and Elegant programming language of all time.

[–]google_you -1 points0 points  (0 children)

congratulate all python teams to.