News for hackers. Stuff that matters.
Re:Python 3.4.0 alpha 1 released by bsaul on Sunday August 04, 2013 @02:41PM (#6156597)
Sorry to harass the hn community over this one more time, but does anyone knows if optional static typing is even being discussed as a future evolution for python ? I know about the pep for annotations that could be used for that ( but in a non standardized way ), i know about the mypy project ( which seems like a one man project), but is that all ?
Re:Python 3.4.0 alpha 1 released by asperous on Sunday August 04, 2013 @03:49PM (#6156822)
Well there is Cython, which is compatible with your every day python, but it might not be what you're looking for. Rpython has some type inference, but it's designed exclusively to be used to make interpreters; no standard libraries or anything.

Personally I think the most amazing and practical (but possibly difficult) thing to do is to add global type inferencing (Hindley–Milner?) to (a fork of?) Jython.

There's also python-like languages with static typing already like boo: http://boo.codehaus.org/

Re:Python 3.4.0 alpha 1 released by wahnfrieden on Sunday August 04, 2013 @03:50PM (#6156831)
Re:Python 3.4.0 alpha 1 released by briancurtin on Sunday August 04, 2013 @05:23PM (#6157162)
> Sorry to harass the hn community over this one more time, but does anyone knows if optional static typing is even being discussed as a future evolution for python ?

No, it is not.

Re:Python 3.4.0 alpha 1 released by andrewcooke on Sunday August 04, 2013 @03:37PM (#6156796)
there's also pytyp, which is pure-python (inefficient) but integrates with ABCs as well as annotations. no-one uses it, as far as i know, but i thought i'd throw it out there in case you were interested - http://www.acooke.org/pytyp/

i also have a vague memory of there being discussions on the python ideas list (which i don't read regularly). you might look there.

Re:Python 3.4.0 alpha 1 released by kzrdude on Sunday August 04, 2013 @12:42PM (#6156094)
They still list SHA-3 as one of the features, even though the standard isn't released yet, and it will surely change details from the keccak submission (has been hinted at several conferences).

By introducting functions like `sha3_256` they are setting themselves up for a big compatibility fiasco.

Re:Python 3.4.0 alpha 1 released by nknighthb on Sunday August 04, 2013 @12:58PM (#6156147)
I cannot conceive of the world in which substantive changes would be made between now and publication. The algorithm has been vetted as-is, any changes would need extensive reevaluation. It would basically be starting the process over.
Re:Python 3.4.0 alpha 1 released by kzrdude on Sunday August 04, 2013 @01:23PM (#6156243)
It's not substantive changes, but any change is enough to change compatibility. If you doubt me, go to the NIST website for SHA-3 standardization and check out the conference talks they linnk to.
Re:Python 3.4.0 alpha 1 released by nknighthb on Sunday August 04, 2013 @07:21PM (#6157508)
I didn't realize they hadn't selected final parameters yet. I guess I blindly assumed they wouldn't be so reckless as to run the clock down this far. Another reason not to trust NIST's judgement.

Nonetheless, you're still panicking over nothing. 3.4.0 won't be released until next year.

Re:Python 3.4.0 alpha 1 released by kzrdude on Monday August 05, 2013 @10:57PM (#6164570)
I don't understand why it would be a bad thing for them to take their time to make the standard as good as possible. It's going to live for pretty long.
Re:Python 3.4.0 alpha 1 released by nknighthb on Monday August 05, 2013 @11:22PM (#6164625)
They're doing the exact opposite. They chose an underspecified "winner". The public vetting period for what actually becomes SHA-3 will now be a mere 90 days.
Re:Python 3.4.0 alpha 1 released by etanol on Sunday August 04, 2013 @12:49PM (#6156117)
I can't see any mention of the new asynchronous programming support presented by Guido in this year's PyCon. Has it been discarded from this release?
Re:Python 3.4.0 alpha 1 released by raymondh on Sunday August 04, 2013 @04:59PM (#6157067)
Tulip is a work in progress. It will be ready when it is ready :-)

Guido is still planning for this to make it into Python 3.4. This isn't a beta release. There are more features to come.

Re:Python 3.4.0 alpha 1 released by bdarnell on Sunday August 04, 2013 @01:05PM (#6156168)
It didn't make the cut for the first alpha, but it is still slated for inclusion in 3.4. The release schedule, including other candidate features, is at http://www.python.org/dev/peps/pep-0429/
Re:Python 3.4.0 alpha 1 released by glazskunrukitis on Sunday August 04, 2013 @10:03AM (#6155665)
Sweet - a standardized "enum" module. I wonder if/when will Django adapt this in their Model definition?
Re:Python 3.4.0 alpha 1 released by raymondh on Sunday August 04, 2013 @04:55PM (#6157057)
In my opinion, the enum module will do very little to improve your life. It uses a great deal of machinery to solve a somewhat shallow problem.

Yes, there will be a few cases when it will improve code and help manage complexity. But it introduces its own complexities as well (i.e. learning two distinct enumeration types, serialization issues, etc).

One example of an unexpected complication is the effect on serialization. Python is having to change (and slow down) its JSON module just to accommodate integer enums (http://bugs.python.org/issue18264). Third-party modules will need to adapt as well. Another example is the awkward __module__ attribute that you will need to support pickles.

That said, the real issue is that for many everyday needs, it is hard to beat the simplicity of what people were already doing. For example, sometime you only need a couple of constant references into list positions: PREV=1; NEXT=2; link_next[PREV] = link_prev[NEXT]. Or you need a handful of self-describing constants that can be compared for equality: ROUND_DOWN = 'ROUND_DOWN'; ROUND_UP = 'ROUND_UP'. Both of these examples were taken from code in the standard library. Both work just fine and do not need any of the high-powered machinery in the enum module.

Once in a while, having an enum will be nice, but you can expect people to go wild with it and use them everywhere. This will churn your code without producing any visible benefit for end users. Just as with PEP 8, the enum module will attract fools like moths to a flame.

Do yourself a favor and don't push for enums to be used everywhere. Show restraint and save them for cases like the socket module where we really did need a way to manage the menagerie of constants.

Re:Python 3.4.0 alpha 1 released by RogerL on Sunday August 04, 2013 @11:30AM (#6155910)
Seconded - I just made a gushing sound that made my girlfriend think I saw a puppy online or something.

I may need help.

Re:Python 3.4.0 alpha 1 released by burntsushi on Sunday August 04, 2013 @02:41PM (#6156598)
Note that you can actually use the same `enum` interface on Python 2.4+ now that it has been standardized. Just install from PyPI. :-) [1]

[1] - https://pypi.python.org/pypi/enum34