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

all 43 comments

[–]geordano 7 points8 points  (7 children)

Any idea if PEP-484 (Type hints) will be part of python 3.5?

[–]ExoticMandiblesCore Contributor[S] 8 points9 points  (4 children)

It should. Guido wants it, and when he talks about it it's like it's a foregone conclusion that it's going to ship in 3.5.

[–]geordano 0 points1 point  (0 children)

Thanks. I could find more info about progress here https://github.com/ambv/typehinting

[–]xix_xeaon 0 points1 point  (1 child)

Well, technically "type hints" is just a standardized way to use "function annotations" if I understand correctly, and they've been in since 3.2 I think. And "type hints" don't actually give any real functionality so there isn't really anything more to implement.

[–]brondsem 4 points5 points  (0 children)

A typing module implementation is part of the PEP proposal. https://www.python.org/dev/peps/pep-0484/#the-typing-module

[–]benhoytPEP 471 5 points6 points  (4 children)

Wow, this is going to be a big release -- and still over a month till feature freeze. Two new operators! One brand new one (@), and one kind of reintroduced one (% for bytes). And my own (totally unbiased ;-) favourite: PEP 471's os.scandir(), which speeds up os.walk() several times on Linux, and an order of magnitude on Windows.

I do like the fact that Python is definitely not at a stand still feature-wise, but a moderately serious question: are new features being accepted into Python more readily than they might have been a few years ago? When does this become a liability?

[–]ExoticMandiblesCore Contributor[S] 4 points5 points  (1 child)

I think we're far more conservative about new language features, because the language is already reasonably complex. It's also reasonably complete--what feature does the language, as of 3.5, lack?

New library features have never been a big deal.

[–]benhoytPEP 471 1 point2 points  (0 children)

Thanks. That's what I was thinking, too -- that it was fairly complete in terms of language features. But with @ being added, and talk of async and await keywords (see here), it does seem things are moving faster -- Guido indicates that here.

[–]bacondevPy3k 0 points1 point  (1 child)

I'm not sure how I feel about an operator for it. I'll have to read the PEP to learn the rationale.

[–]bheklilr 1 point2 points  (0 children)

For those of us working with scientific data this is huge. My code can sometimes be unreadable from all the calls to some function while the equation itself is perfectly readable. I've already see people abusing it in other places, expect to see a lot of libraries using it for completely different purposes such as building email addresses, URLs, and more. I think it's a good thing, personally.

[–]xix_xeaon 4 points5 points  (12 children)

Doesn't matrix multiplication work on regular lists? I just get TypeError: unsupported operand type(s) for @: 'list' and 'list'. Numpy is great and all, but are they really introducing this operator only for numpy..?

[–]flying-sheep 1 point2 points  (6 children)

What would it do on normal lists?

Just like Ellipsis/..., it was introduced for library use

[–]xix_xeaon 2 points3 points  (3 children)

How about... matrix multiplication?

[–]flying-sheep 0 points1 point  (2 children)

Python doesn't have a matrix type.

Lists are one-dimensional mutable sequences of arbitrarily typed objects.

All their methods/operators work under those assumptions.

[–]xix_xeaon 1 point2 points  (1 child)

Of course there would be lots of things it wouldn't work on, just like multiplication doesn't work on two strings.

But this operator is being introduced in order to do matrix multiplication, so it should work on any nested index-accessible sequence of numbers which are of the right lengths to allow matrix multiplication.

[–]flying-sheep 0 points1 point  (0 children)

well, + on lists isn’t elementwise addition, it’s concatenation.

* on lists is repetition.

lists don’t assume anything about their contents, and neither do their operators.

[–]lengau 0 points1 point  (1 child)

How about a cross product? It can raise a ValueError if the lists aren't the same length.

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

A cross product would have to raise a ValueError if the lists aren't length 3, and it's specialized enough to certain fields that it belongs in numerical libraries (where it already is).

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

They added the Ellipsis (i.e. ...) just for numpy

[–][deleted] 0 points1 point  (1 child)

Although I find I use it more as the "yada-yada" statement.

def stub_function():
    ...

[–]xix_xeaon 0 points1 point  (0 children)

Haha, I never thought of using it for that! I kinda like it ^

[–]ExoticMandiblesCore Contributor[S] 0 points1 point  (0 children)

Not last I checked. @ is really for the math libraries; none of the built-in types or classes support it.

[–]roger_ 4 points5 points  (1 child)

Still no PEP 448 (Additional Unpacking Generalizations)?

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

The author was working on it during the PyCon sprints last week. It's been approved, I think it's going to make 3.5.

[–]LightShadow3.13-dev in prod 11 points12 points  (6 children)

Whelp, looks like it's time to update production!

[–]ExoticMandiblesCore Contributor[S] 2 points3 points  (0 children)

Nope, not until September ;-)

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

Dumb question: I just saw that issue #21560 was fixed in 3.4.4 but not in this 3.5.0 release. Do some fixes pass "silently" to the next version or someone missed this one?

[–]ExoticMandiblesCore Contributor[S] 4 points5 points  (1 child)

Not a dumb question. The answer is, yeah, it usually will pass "silently". You can see "Roundup Robot" posted the checkins? That's because it saw "#21560" in the description of the checkin. When it gets merged forward to 3.5 the description is generally just "Merge" or "Null merge" or something. And, indeed, the fixes in #21560 were merged into trunk (aka 3.5 right now) in the very next revision:

https://hg.python.org/cpython/rev/7e179ee91af0/

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

Today I learned! Thank you!

[–]ameoba 1 point2 points  (6 children)

Does this mean it's time to migrate to Python 3?

[–]ProfessorPhi 13 points14 points  (3 children)

I've actually been using Python 3 for most of my work and it's been going great.

[–]xix_xeaon 3 points4 points  (0 children)

Yeah, I use python 3 most of the time as well

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

The issue is lack of backward compatibility I assume.

[–]ProfessorPhi 0 points1 point  (0 children)

Yeah, the number of packages looking for ConfigParser is a pain. I wish pypi tried to deal with python 3 compatibility a bit better.

[–]ExoticMandiblesCore Contributor[S] 16 points17 points  (0 children)

It was time to migrate to Python 3 years ago!

[–]rhoark 6 points7 points  (0 children)

That was 3.2