Python 2.6 to Smooth the Way for 3.0, Coming Next Month
darthcamaro writes "Some programming languages just move on to major version numbers, leaving older legacy versions (and users) behind, but that's not the plan for Python. Python 2.6 has the key goal of trying to ensure compatibility between Python 2.x and Python 3.0, which is due out in a month's time. From the article: 'Once you have your code running on 2.6, you can start getting ready for 3.0 in a number of ways,' Guido Van Rossum said. 'In particular, you can turn on "Py3k warnings," which will warn you about obsolete usage patterns for which alternatives already exist in 2.6. You can then change your code to use the modern alternative, and this will make you more ready for 3.0.'"
piss? goat.
English is not my first language, but isn't "more ready" wrong?
because of that
Why not just wait for 3.0 to make the changes? That way you'll only have to test everything once.
And if it's like some other languages you might have a long time to wait before 3.0.
Obama will castrate our military and destroy our nuclear deterrent.
http://www.youtube.com/watch?v=cxL8NcNACBY
He will tax corporations and high income earners that employ the population of the US, which will force them to cut jobs and send the unemployment rate skyrocketing.
http://obama.3cdn.net/b7be3b7cd08e587dca_v852mv8ja.pdf
He sees dead people.
http://www.youtube.com/watch?v=galtZF0nKYc
He wants to take the guns out of the hands of law abiding citizens, leaving us at the mercy of criminals.
http://www.ontheissues.org/2008/barack_obama_gun_control.htm
He'll cut and run from Iraq, knocking the legs out from under the Iraqi government as they are finally finding their footing.
http://www.barackobama.com/issues/iraq/
He believes homosexuals are entitled to more rights than straight people.
http://www.cnn.com/2007/POLITICS/07/23/debate.transcript/index.html
He believes in mob rule concerning criminal punishment.
The Audacity of Hope, by Barack Obama, p. 58
He refuses to call terrorists "terrorists" even when presented with evidence.
http://www.npr.org/templates/story/story.php?storyId=15251928
He will prevent us from keeping sensitive materials confidential, which will place national security at risk.
http://www.cfr.org/publication/14356/
He would talk with terrorist countries without demanding that they cease their efforts to murder innocent people and abide by the rule of law.
http://www.youtube.com/watch?v=e3Oj7Jn9rv4
He believes we should reward people who ignore the existence of a country's sovereignty and illegally enter the country instead of forcing them to abide by the law.
http://obama.senate.gov/news/060923-sen_obama_at_to/index.php
He believes the government should regulate the internet.
http://obama.senate.gov/podcast/060608-network_neutral/index.php
He believes in making those who have money pay for the healthcare of those who do not have money.
http://www.barackobama.com/issues/healthcare/
He believes we should take corn, a staple food for the US, and use it for ethanol production, which will cause shortages in food supply and produce car exhaust that is more dangerous to humans than gasoline burning cars.
http://www.boston.com/news/nation/washington/articles/2007/01/05/new_us_congress_looks_to_boost_alternate_fuels/?p1=MEWell_Pos5
He believes that parents should have no choice but to send their children to government run schools to be indoctrinated by sub-standard teachers.
http://www-news.uchicago.edu/citations/04/041027.obama-ct.html
In short, he's an anti-American, anti-military Marxist who will destroy the US before he can be voted out of office. I don't like McCain and I have problems with many of his positions, but he will, at the very least, keep the US from crashing and burning within the next 4 years (provided the Dems don't win Congress).
And no, he's not a Muslim (as far as we know). He's not black (he's bi-racial). He's not a Christian (against everything Ch
A few years ago, while browsing around the library downtown, I had to take a piss. As I entered the john a big beautiful all-american football hero type, about twenty-five, came out of one of the booths. I stood at the urinal looking at him out of the corner of my eye as he washed his hands. He didn't once look at me. He was "straight" and married -- and in any case I was sure I wouldn't have a chance with him. As soon as he left I darted into the booth he'd vacated, hoping there might be a lingering smell of shit and even a seat still warm from his sturdy young ass. I found not only the smell but the shit itself. He'd forgotten to flush. And what a treasure he had left behind. Three or four beautiful specimens floated in the bowl. It apparently had been a fairly dry, constipated shit, for all were fat, stiff, and ruggedly textured. The real prize was a great feast of turd -- a nine inch gastrointestinal triumph as thick as a man's wrist. I knelt before the bowl, inhaling the rich brown fragrance and wondered if I should obey the impulse building up inside me. I'd always been a heavy rimmer and had lapped up more than one little clump of shit, but that had been just an inevitable part of eating ass and not an end in itself. Of course I'd had jerk-off fantasies of devouring great loads of it (what rimmer hasn't), but I had never done it. Now, here I was, confronted with the most beautiful five-pound turd I'd ever feasted my eyes on, a sausage fit to star in any fantasy and one I knew to have been hatched from the asshole of the world's handsomest young stud. Why not? I plucked it from the bowl, holding it with both hands to keep it from breaking. I lifted it to my nose. It smelled like rich, ripe limburger (horrid, but thrilling), yet had the consistency of cheddar. What is cheese anyway but milk turning to shit without the benefit of a digestive tract? I gave it a lick and found that it tasted better then it smelled. I've found since then that shit nearly almost does. I hesitated no longer. I shoved the fucking thing as far into my mouth as I could get it and sucked on it like a big brown cock, beating my meat like a madman. I wanted to completely engulf it and bit off a large chunk, flooding my mouth with the intense, bittersweet flavor. To my delight I found that while the water in the bowl had chilled the outside of the turd, it was still warm inside. As I chewed I discovered that it was filled with hard little bits of something I soon identified as peanuts. He hadn't chewed them carefully and they'd passed through his body virtually unchanged. I ate it greedily, sending lump after peanutty lump sliding scratchily down my throat. My only regret was the donor of this feast wasn't there to wash it down with his piss. I soon reached a terrific climax. I caught my cum in the cupped palm of my hand and drank it down. Believe me, there is no more delightful combination of flavors than the hot sweetness of cum with the rich bitterness of shit. Afterwards I was sorry that I hadn't made it last longer. But then I realized that I still had a lot of fun in store for me. There was still a clutch of virile turds left in the bowl. I tenderly fished them out, rolled them into my hankerchief, and stashed them in my briefcase. In the week to come I found all kinds of ways to eat the shit without bolting it right down. Once eaten it's gone forever unless you want to filch it third hand out of your own asshole. Not an unreasonable recourse in moments of desperation or simple boredom. I stored the turds in the refrigerator when I was not using them but within a week they were all gone. The last one I held in my mouth without chewing, letting it slowly dissolve. I had liquid shit trickling down my throat for nearly four hours. I must have had six orgasms in the process. I often think of that lovely young guy dropping solid gold out of his sweet, pink asshole every day, never knowing what joy it could, and at least once did, bring to a grateful shiteater.
These kind of compatibility switches are make-or-break. I'm glad there's Python 2.6 to try to ease the problem, but Py3k means that everybody who publishes python software will all of a sudden have to maintain 2 branches, for Python 2.X line and Python 3.X line.
This isn't the same as one software package having "legacy" and "bleeding edge" branches, because that's their own choice. In this case the underlying language is forcing them to choose.
Honestly, I'm not confident in the economics of such transitions, and believe Py3k will die out.
Misleading titles? Inflammatory blurbs? Keep in mind that Slashdot is a tabloid.
Here are the changes.
I really have to check out the multiprocessing package. Too bad that I have to wait for the print function and the new division handling.
I've been sticking with perl. One of their significant criticisms to me is a strength: their development is relatively stagnant.
Perl6 has been an ever-present worry, but transitions from perl5.6 or so to perl5.10 has been fairly rock solid. I was a python user, but too many changes between even relatively minor updates had me revisiting scripts time and time again. I converted to perl in search of a capable scripting language that wasn't screwing around so much, even if the syntax at times is peculiar.
I will say the same thing that plagues python has plagued Java and probably hosts of other platforms. Platform developers often do more than 'extend' new features, they trample on existing things along the way 'improving' them. Generally, I can see arguments why it happened, but the fact of the matter is a language doing that is pretty crappy..
XML is like violence. If it doesn't solve the problem, use more.
The inbetween release is because they're adding braces to version 3 and they want to give people time to prepare for the transition.
haha! Python ! Do you get it ? Guido named it after MPFC, this is very amusing. Do you get it ? haha Python....it's MPFC! Haha, do you see ?
These changes are NOT earth-shattering. 2.6 is mostly just going to add a few new features, most important being the with statement. Most code written using Python idioms will be fine under 2.6 and 3.0. Now, if you tried to write Java-esque or C-esque code under Python, you might run into issues. Even then, I doubt it. They've been deprecating features for awhile, and 3.0 is probably the point at which they'll be yanked...you've only had a year or two of DeprecationWarnings.
I'm not sure why people whine about a language evolving. Retain backwards compatibility to a fault and you end up with C++, which is crippled by C-isms. You either know your code well enough that you could make the small incremental changes along the way, or you simply don't upgrade.
Python most needs sane standard libraries. It is far too much of a "let's throw this in there" with three different naming conventions and no package organization. It is a shame, because the language itself is pretty powerful in the right hands.
What Python features broke for you between minor releases?
I find it pretty hard to believe any Python user would actually switch to Perl, and stick to it.
You sir, are probably making this story up :-)
Reading the release, they have decided to really push 16-bit strings (they call this "Unicode" but it really is what is called UTF-16). I think this is a serious mistake.
The proper solution is to use 8-bit strings, but any functions that care (such as I/O) should treat them as being UTF-8. Most functions do not care and thus the treatment of "Unicode" and "bytes" are the same.
The problem with UTF-16 is you cannot losslessly convert a string that *might* be UTF-8 to UTF-16 and then back again. This is because any illegal UTF-8 byte sequences will be lost or altered. This is a MAJOR problem for code that wants to process data that is likely to be text but must not be altered under any circumstances, in effect such programs are forced to be ASCII-only, even though UTF-8 is purposly designed so that such programs could display all the Unicode characters. Note that bad UTF-16 (ie with mismatched surrogate pairs) can be losslessly converted to UTF-8 and back.
This has been a real pain so far in our use of Python, and I am quite alarmed to see that they are changing the meaning of plain quotes in 3.0 to "Unicode". This is really a serious step backwards, as we will be forced to tell anybody using our system to put 'b' before all their string constants and I suspect there will be a lot less automatic conversion of these strings to unicode when we want to display them. Note that Qt is also causing a lot of trouble here too.
You can keep your code compatible with both at the same time. Deprecated features are trivial to rewrite in most cases. There are even tools for this.
Most distros already include the current and previous versions of Python. So Ubuntu, for instance, will include 2.6 and 3.0, and possibly 2.5 as well.
Furthermore, you can check to see what version of Python you're running under and make your code so that it accomodates both. This is all accessible via sys.version or sys.version_info
>>> sys.version
'2.5.1 (r251:54863, Jul 31 2008, 22:53:39) \n[GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)]
>>> sys.version_info
(2, 5, 1, 'final', 0)
With that knowledge, you just put all your version specific stuff in modules.
So you can do a:
import sys
major,minor,micro,release,release_num = sys.version
if (major > 3):
import module_for_python_3.0
else:
import module_for_python_2.x
My blog
Many essential third party libraries need to be converted for Python 3.0. I need M2Crypto (SSL support) and MySQLdb (MySQL support), neither of which is ready for Python 3.0, and neither of which has been updated in the last year or so.
My guess is that it will be three years before stock mainstream Linux distros come with Python 3.0 and a set of libraries that work with it.
Anthony Baxter gave a pretty good talk on the implications at LCA 2008 earlier this year.
http://video.google.com/videoplay?docid=4264641260805367198&hl=en
"Everything is adjustable, provided you have the right tools"
3.0rc1 (beta) is already available and has been for some time now. The advantage of 2.6 is not as much its backward-compatibility but its ability to tell you exactly what needs to change (via runtime warnings) for 3.0 without actually breaking your code. I've been using both for months now, so this article isn't exactly hot news.
Between 2.x series I saw DB access strategies change, for example. That's the prominent one that pushed me over the edge to try perl.
> Obama will castrate our military and destroy our nuclear deterrent.
I don't mind. As far as spending and numbers are concerned, we already outnumber the rest of the world. And anyone crazy enough to use nukes is crazy enough to not care about US deterrent.
> He will tax corporations and high income earners that employ the population of the US, which will force them to cut jobs and send the unemployment rate skyrocketing.
Several prominent economists disagree with this assessment. And even if it's true, New-Deal style job creation is in the pipe too.
> He sees dead people.
Who the fuck cares.
> He wants to take the guns out of the hands of law abiding citizens, leaving us at the mercy of criminals.
If you read the linked article, you'd know this is a misrepresentation.
> He'll cut and run from Iraq, knocking the legs out from under the Iraqi government as they are finally finding their footing.
Likewise an oversimplification. The 16 months are tied to a timetable of phasing in Iraqi control of Iraq. This is no more cutting and running than a road trip is reckless driving.
> He believes homosexuals are entitled to more rights than straight people.
This claim is not supported by the transcript.
> He refuses to call terrorists "terrorists" even when presented with evidence.
No, he refuses to call a losing battle a winning battle, even if doing so keeps certain terrorists from being classified as such. The bill in question covered an omnibus of opinions, and disagreeing with one does not mean he disagreed with the whole bill.
> He will prevent us from keeping sensitive materials confidential, which will place national security at risk.
The stated plan is to go through classified materials and determine what can be declassified without threatening national security; the hypothesis is that there are many such documents kept classified for political reasons. If all of those materials really do need classified status, the department will do nothing. I fail to see the issue here.
> He would talk with terrorist countries without demanding that they cease their efforts to murder innocent people and abide by the rule of law.
Why would a country that is convinced you are the enemy do anything you tell it to do? Why would a country with whom you will not communicate listen to your demands?
> He believes the government should regulate the internet.
The government is already giving the people who run the internet an exception from antitrust law, on the basis of the "natural monopoly" created by the wires. In fact, the government helped pay for those wires. Shouldn't it have a say in how those wires are used?
> He believes in making those who have money pay for the healthcare of those who do not have money.
The alternative is for those with no money to have no healthcare either. Most of the country considers that unacceptable.
> He believes we should take corn, a staple food for the US, and use it for ethanol production, which will cause shortages in food supply and produce car exhaust that is more dangerous to humans than gasoline burning cars.
He believes we should use corn ethanol as one of many replacements for oil. Corn production has already skyrocketed on speculation for this alternative fuel. Meanwhile, your comments on the dangerous nature of ethanol exhaust are supported neither by the article nor a cursory Google search on the matter.
> He believes that parents should have no choice but to send their children to government run schools to be indoctrinated by sub-standard teachers.
How do you know? The linked article only mentions that he happens to send his kids to a private school where he gets a discount. Not supporting vouchers does not mean wanting to destroy private schools. They seem to be getting by well enough without government hand-outs.
> In short, he's an anti-American,
What the fuck does that mean.
> anti-military
And why not?
> Marxist
This is pretty much a given in both Ruby and Rails! In every case I know of, users had advance warning from their interpreters when anything was deprecated and would become obsolete within a few versions.
Sounds like Python is bragging about something their chief competitor has been doing better for a long time.
Microsoft and lots of other proprietary software companies does that all the time... :)
This trolling problem is getting out of hand. I really think that we should consider banning suspect IP ranges and proxies. Near half of this page is trolling. It's making reading real comments prohibitively difficult, especially with people responding to -1 posts.
In the immortal words of Wolfgang Pauli, this isn't right. It isn't even wrong.
If you are using text, YOU ARE USING UNICODE. There is NO such thing as plain text. No exception. Just because you don't understand where Unicode comes in between the bytes you naively think of as characters and the text as it appears on your screen, doesn't mean it isn't there. It does mean, however, that you are one of the countless incompetents whose code people like me get to waste hours fixing, so thank you, ÐÏÏнөÅÐ. :|
For whatever reason, people fail to understand python natively supports parallel installs.
But some popular environments (Windows, Mac, shared web hosting) identify scripts not by their script magic but instead by their file extension. When I used Google to search for python parallel install windows, I got a whole bunch of results about parallel ports and parallel processing. Does a parallel install work in Linux, Solaris, *BSD, and the like, or is there a recommended way to use it with more popular desktop operating systems such as Windows and Mac OS X? And how do parallel installs interact with web hosting?
Another common pattern to use for this, as well as for libraries, is the following:
try:
import one_way_to_do_it
except:
import more_common_way_to_do_it
But how well does a try block work with things that depend on from __future__ statements that Python 2.5.x doesn't recognize, such as the different print syntax and the different string literal syntax ("8bitchars", u"32bitchars" vs. b"8bitchars", "32bitchars")? From Python 2.5.x's definition of a future statement:
This appears to exclude try statements.
So don't use Python 3.0.
That woul dbring the same problems as the transition from PHP 4 to PHP 5. How would I deploy my product to end users who have installed Python 3.x as the system-wide handler for .py files? Will Python Software Foundation recommend the use of an extension such as .py2? Conversely, if I do take advantage of Python 3.x, how would I deploy to end users who still use 2.x?
The problem with UTF-16 is you cannot losslessly convert a string that *might* be UTF-8 to UTF-16 and then back again. This is because any illegal UTF-8 byte sequences will be lost or altered.
Then set strict conversion, which will raise UnicodeError for any nonconforming byte sequences. My problem with UTF-16 is how it bloats in-memory databases of mostly-ASCII text by a factor of nearly 2 (or 4 if Python is compiled with UTF-32 to handle hieroglyphics and ancient Chinese).
There seems to be a massive increase in trolling recently.
So, if your code requires Python 2.5, you could just have "#!/usr/bin/env python2.5" at the beginning of your script, and it would be run using the python2.5 command.
Is there a way to get Windows Explorer or Apache mod_python to follow the #! line instead of the .py extension?
Don't mod something down just because you disagree. When I have mod points, I never downmod things out of disagreement. This is a legitimate concern over the python strategy. They have benefited from their flexibility (the language at a given instant I will give is relatively low on quirks as they are rethought and replaced, whereas perl is chock-full of quirks that you must learn to live with), but there is a price.
Nothing is perfect. Nothing is without flaws. To achieve one end, something almost always is given up. Don't mod a post down because it points out what was given up to achieve an impressive advantage.
XML is like violence. If it doesn't solve the problem, use more.
"Troll" for THAT comment? Man, somebody does not know what "troll" means!
Nothing I can do about it but bitch, but my bitch is legitimate.
NEWS, modders: disagreement does NOT automatically equal "troll".
No. You can go on all you want about "needed to change" and "autofix" and etc, but the bottom line is that this code presently isn't broken, and I am not about to fix code that isn't broken. It makes no sense on any level; financially, time-wise, or strategically. I have better things to do than refactor my code for entirely arbitrary reasons. Perhaps I just place a different value on my time than you do; that's fine. You should, of course, feel free to do whatever you like.
I've fallen off your lawn, and I can't get up.
Request a government bailout for being dumbasses and hosting on windows?
Shared Linux hosting also has problems with different versions of an interpreter. I didn't see anything in the mod_python manual about ability to select an interpreter based on the #! line. I've changed the subject line to clarify.