Readers should note that this release has significant backwards incompatibilities with the 2.X series, both at the language level and also in the C APIs available to extension module authors. These have been introduced by design, with the goal of improving the language in the long term, but this situation has implications for production use.I hope that clarifies things, but I would welcome further ideas to refine this text and make it more helpful. One of the primary reasons for using 3.0 is to get a migration strategy ready. But 3.0 is undoubtedly not for everyone, at least not just yet.
Furthermore it is likely that there will be a considerable delay before some authors of Python packages and extension modules start to provide 3.0-compatible releases. There are significant hurdles to be overcome in migrating extension modules from Python 2 to Python 3.
For these reasons you are NOT recommended to rely on Python 3.0 as your main production Python implementation until you know that all supporting code is available in compatible forms. While every care has been taken in the production of the Python 3.0 release, and the release team feels that the system is of a quality comparable with the recently-released Python 2.6, the latter system is currently the recommended version for production use.
November 13, 2008
Don't Use Python 3.0? Really?
It's difficult to say "don't use Python 3.0" without being rude to the developers, as the code seems to be of very high quality. Now that Python 3.0 is almost here (release candidate 2 is a week old as I write) we should encourage people to use it, but only under well-defined circumstances. Here is some text I put together for inclusion in the release notes, to give people guidance about when and why it is and isn't appropriate to use 3.0. I would welcome further ideas to refine this text.
November 12, 2008
Phrase From Nearest Book
Well, here's a turn-up. I spotted this meme on Grig Georghiu's blog.
- Grab the nearest book.
- Open it to page 56.
- Find the fifth sentence.
- Post the text of the sentence in your journal along with these instructions.
- Don’t dig for your favorite book, the cool book, or the intellectual one: pick the CLOSEST.
If he is gay, man needs man; otherwise, man needs woman.This doesn't actually represent the compelling nature of Dooling's prose particularly well. For that I like the next two sentences rather better:
Not photos or Web clips or blog entries or text messages or e-mails or even video clips taken of or sent by woman. Man needs woman in the flesh, in meatspace, where he-meat meets she-meat to beget meatlets.Anyway, it will be interesting to see what others come up with.
November 11, 2008
United.com Broken
So I have this trip coming up to San Diego, and I fly tomorrow. I get this friendly little Web-2.0 e-mail from United. It comes from an address in a subdomain of p0.com, telling me that United are using Yesmail, and it includes a link for me to follow to "view my complete itinerary". They even have it link to a server in the p0.com domain so my browser doesn't think this is a phishing attack. The only problem comes when I click on the link, and repeatedly see
Connection InterruptedThe connection to the server was reset while the page was loading.The network link was interrupted while negotiating a connection. Please try again.
"Not to worry", I think to myself, "I'm a United frequent flyer (God help me), so I can just log in to my Mileage Plus account and check my itinerary there". Of course this wouldn't have been much of a post if that had worked, but good old United didn't let me down. Every attempt to log in gives me
Redirect LoopFirefox has detected that the server is redirecting the request for this address in a way that will never complete.The browser has stopped trying to retrieve the requested item. The site is redirecting the request in a way that will never complete.
Attempts to retry just bring up the same message again. Wonderful. Let's hope the people who run the web site have nothing to do with keeping the 'planes flying.
[PS: Fortunately this appeared to be a transient condition. The site now responds normally.]
November 10, 2008
Final "Introduction to Python" of 2008
As the year draws to a close Holden Web is pleased to remind readers that its final public "Introduction to Python" class of this year will be held from December 9-11 at our education center close to Washington, DC.
There are several hotels conveniently located within walking distance, and we provide breakfast snacks and lunch each day.
Purchase places on-line by credit card or using PayPal.
Thanks to all students who have already attended this class. We look forward to meeting you again as our range of course offerings increases.
November 9, 2008
For Would-Be Python Users
If you are new to Python, or know someone else who is, you (or they) could do a lot worse that visit Richard Dooling's Seven Minutes to Hello World web page. It explains about the easiest way to get Python up and running on your Windows XP computer.
I am pretty sure it will run for Vista too, the only reservation I have being the need to run the installer as an administrator if you want to install Python for all users. Since most Vista systems are single-user machines anyway, this isn't likely to be a big issue.
I am pretty sure it will run for Vista too, the only reservation I have being the need to run the installer as an administrator if you want to install Python for all users. Since most Vista systems are single-user machines anyway, this isn't likely to be a big issue.
November 7, 2008
World Plone Day? Communicate, Dammit!
So just now, somewhat after midday Eastern Time, I discover that today is World Plone Day.Forgive me for saying so, but as Python Software Foundation chairman I should have expected to hear about this event a little in advance. I would even have welcomed the opportunity to lend PSF resources towards publicizing it, seeing as how Plone is one of Python's showcase applications. Alas apparently nobody thought to try and use the PSF as a channel. So I hope World Plone Day goes well this year, and that it doesn't pass everybody else by as it did me.
For the record, the PSF runs its own blog, whose articles are well-syndicated on the web, and we are also usually happy to put Python-related events as front-page news on the python.org web site.
If you are running some newsworthy event, mail the webmasters (if you aren't savvy enough to work out the correct email address, webmaster at python dot org should get you there) to avail yourselves of the opportunity! However can we achieve world domination if we continually hide Python's light under a bushel?
October 30, 2008
A Joke, or an Accident?
I can't decide whether Greg Wilson posted this as a joke. In case he didn't, and whatever error induced this behavior is fixed by the time you click on the link, I attach a current screenshot. Click on the image to look at the title and see what amused me.Either way I think it's funny. No, it doesn't take a lot to amuse me. I guess I'm just a geek at heart.
October 29, 2008
Stani Wins Coin Design Competition
If you subscribe to the Planet Python feed you will already know that Stani (this is to the best of my knowledge the only name he advertises), the author of the well-known Stani's Python Editor, just won a competition to design a new Dutch five-Euro coin.Congratulations, Stani, and not just for an exceptionally creative use of open source software (including Python, naturally), but also for a fine demonstration of its ideals. What a pity you can't release the coin under a copyleft agreement!
It seems to me this is just another area where the demonstrable abilities of open source are only just beginning to make an impression. You ain't seen nothing yet!
October 26, 2008
Norton Antivirus 2009 on Vista is a Liabilty
Today, for the second time in less than two weeks, the first attempt to collect mail after a reboot cause the appearance of a rather unpleasant notification dialog indicating that my Antivirus software has stopped working:The first time this issue occurred I spent almost four hours online with the Symantec support technicians, having my software removed and re-installed several times without any resolution of the issue. At that point I had to go out, and when I returned the issue was somehow gone. I assumed that some component had been automatically updated, and continued on my merry way.
Today, we went through the same remove/re-install rigmarole with no more success. After the technician (who was controlling my computer remotely) went quiet for three or four minutes, then he closed the browser windows and disconnected the support session. Thanks very much.The really annoying thing is that this is a known issue that Symantec claim will "be fixed in the next support upgrade", but there is no information about when this upgrade will happen, and neither does there appear to be a workaround I can apply until the fix appears, short of falling back to Norton Antivirus 2008. So I suppose that's what I'll have to do.
I'm guessing there are a lot of other people experiencing the same issue, because I started out as eighteenth in line for support. I am now next, and looking forward to going back to the prior release. But that was installed by a Symantec technician in response to a long-forgotten problem with the 2008 product, so I may not be out of the woods even then. If Symantec think I'm renewing at the end of my current subscription period they have another think coming. I have already spent almost a full day without email twice because of this issue, and I've had enough.
For some reason a number of posts were stuck in the blog as drafts. This one is from October last year.
October 21, 2008
It's Here!
I may be an old fart, but I know when a 'phone is going to be cool. To think I was actually the guy who registered "gPhone.com" (for a client). It would be nice to see Steve McCarthy and Guy Jazynka get something for the name. They might even buy me a pint!At least I get a chance to play with Chrome. So, who knows where the Python interpreter is?
Shame I am feeling so ropey, I'd have loved to spend the evening playing on the Intarweb. Maybe tomorrow I'll blog from the 'phone.
October 15, 2008
Django Tip: Non-editable Fields
Yesterday I explained how to subclass a DateTimeField, adding a pre_save() method to make it suitable for use as a row creation or modification timestamp. If you do this, however, you will observe that unless you add an editable=False argument to the field instantiation call they will appear as editable fields in any ModelForms containing them. It would clearly be more desirable to have these fields non-editable by default, which can easily be arranged by extending their __init__() method and changing the default value of the editable argument.
The code below also renames the fields more suitably. You can use a similar trick to create other non-editable field types, and also to change other instantiation defaults.
The code below also renames the fields more suitably. You can use a similar trick to create other non-editable field types, and also to change other instantiation defaults.
class ModificationDateTimeField(models.DateTimeField):
def __init__(self, editable=False, *args, **kw):
models.DateTimeField.__init__(self, editable=editable, *args, **kw)
def pre_save(self, instance, add):
val = datetime.datetime.now()
setattr(instance, self.attname, val)
return val
class CreationDateTimeField(ModificationDateTimeField):
def __init__(self, editable=False, *args, **kw):
models.DateTimeField.__init__(self, editable=editable, *args, **kw)
def pre_save(self, instance, add):
if not add:
return getattr(instance, self.attname)
return ModificationDateTimeField.pre_save(self, instance, add)
October 13, 2008
Django Tip: Field.pre_save()
Here's a little thing that can help you to improve the flexibility of your models.
Rather than trying to extend or override Model.save(), if the special action you require only affects one field then define a subclass of the required Field type and define a pre_save() method on the subclass. This will override the default method, which simply returns the attribute value.
I spotted this by following up a discussion of the planned removal of the DateField's auto_now and auto_now_add attributes, which you can assert to set a modification or creation date respectively on rows. Some developers suggested putting the functionality in a decorator that could be used on the model's save() method, but Jacob Kaplan-Moss preferred a trivial subclass:
Unfortunately this is just a little bit too trivial, since pre_save() is required to set the attribute value - every time for auto_now and on first save for auto_now_add. Fortunately the extra code required is pretty small. pre_save() receives three arguments: the first is the field instance, the second is the model instance and the third is a flag which is True only when the save() call is adding a new row to the associated table.
Technically it would be cleaner to use super() to access the superclass methods from AutoNowAddDateTimeField, but as a proof of concept this works fine.
As it happens the auto_now and auto_now_add attributes of DateTimeField were not removed before the release of Django 1.0, so we are likely to be stuck with them until 2.0. But the same technique is useful for any field that needs to receive an automatic value when a model instance is saved.
Rather than trying to extend or override Model.save(), if the special action you require only affects one field then define a subclass of the required Field type and define a pre_save() method on the subclass. This will override the default method, which simply returns the attribute value.
I spotted this by following up a discussion of the planned removal of the DateField's auto_now and auto_now_add attributes, which you can assert to set a modification or creation date respectively on rows. Some developers suggested putting the functionality in a decorator that could be used on the model's save() method, but Jacob Kaplan-Moss preferred a trivial subclass:
class AutoDateTimeField(models.DateTimeField):
def pre_save(self, model_instance, add):
return datetime.datetime.now()
Unfortunately this is just a little bit too trivial, since pre_save() is required to set the attribute value - every time for auto_now and on first save for auto_now_add. Fortunately the extra code required is pretty small. pre_save() receives three arguments: the first is the field instance, the second is the model instance and the third is a flag which is True only when the save() call is adding a new row to the associated table.
class AutoNowDateTimeField(models.DateTimeField):
def pre_save(self, instance, add):
val = datetime.datetime.now()
setattr(instance, self.attname, val)
return val
class AutoNowAddDateTimeField(AutoNowDateTimeField):
def pre_save(self, instance, add):
if not add:
return getattr(instance, self.attname)
return AutoNowDateTimeField.pre_save(self, instance, add)
Technically it would be cleaner to use super() to access the superclass methods from AutoNowAddDateTimeField, but as a proof of concept this works fine.
As it happens the auto_now and auto_now_add attributes of DateTimeField were not removed before the release of Django 1.0, so we are likely to be stuck with them until 2.0. But the same technique is useful for any field that needs to receive an automatic value when a model instance is saved.
October 2, 2008
Python 2.6 Released
Thanks to release manager Barry Warsaw and a cast of thousands! Get it from the usual place.
September 24, 2008
Scratching Setuptools Itches
Interestingly, two different people have announced setuptools replacement/enhancement products on the same day. Maybe we will eventually see some such functionality in the Python standard library. It's obvious there's a lot of pull for the feature set, even though different people have different complaints about the implementation.
September 23, 2008
The Other Side of the Bike Shed
I've long used the C. Northcote Parkinson bicycle shed discussion example to try to focus on the big issues, and suspect I may have been the one to introduce it to comp.lang.python (though someone with superior google-fu would have to confirm or deny that assertion).
It's always a temptation to expend most energy on the issues we feel comfortable with, and rush the discussions on the areas outside our area of competence even though they are the ones we should rationally spend time discussing, grappling with issues and trying to understand.
The current Bush administration proposal, on which they demand action from Congress within a week, sees the other side of the bicycle shed. Urgent action is alleged to be needed, and it seems that many in government are prepared to rush a decision through because they don't really understand the issues.
The fact remains that it's an unconscionable bid to bail out the fat cats whose corporate greed, with the connivance of the SEC, sent the economy down the shitter in the first place. Personally I'd rather see the discomfort spread about rather more democratically, with those who have been making money from their investments in ill-advised mortgages now taking losses still not comparable with those of the often innocent borrowers who are losing their homes by the thousand.
Remember, the value of your investments can go down as well as up.
It's always a temptation to expend most energy on the issues we feel comfortable with, and rush the discussions on the areas outside our area of competence even though they are the ones we should rationally spend time discussing, grappling with issues and trying to understand.
The current Bush administration proposal, on which they demand action from Congress within a week, sees the other side of the bicycle shed. Urgent action is alleged to be needed, and it seems that many in government are prepared to rush a decision through because they don't really understand the issues.
The fact remains that it's an unconscionable bid to bail out the fat cats whose corporate greed, with the connivance of the SEC, sent the economy down the shitter in the first place. Personally I'd rather see the discomfort spread about rather more democratically, with those who have been making money from their investments in ill-advised mortgages now taking losses still not comparable with those of the often innocent borrowers who are losing their homes by the thousand.
Remember, the value of your investments can go down as well as up.
September 22, 2008
PyCon Tutorials, 2009
So, the call for tutorials has gone out, and I am thinking (yet again) of offering at least one. In the past my tutorials have been of an introductory nature: the DB API, wxPython, and last year I taught Python itself (or enough of it for newcomers to be able to understand conference talks) in three hours.
So, what would people like to see this year? I'm minded to do something a little more advanced this time, so I can feed it into Holden Web's public course schedule.
So, what would people like to see this year? I'm minded to do something a little more advanced this time, so I can feed it into Holden Web's public course schedule.
September 20, 2008
The Photo Meme
Instructions: Take a picture of yourself right now. Don't change your clothes, don't fix your hair - just take a picture. Post that picture with NO editing. Post these instructions with the picture.
From a post by Jeremy Hylton.
September 12, 2008
Python 2.6 First Release Candidate Due Today
To maintain the fairly aggressive release schedule Barry Warsaw and the Python developers have decided to decouple the 2.6 and 3.0 releases, so 3.0 will now be slightly delayed - maybe by a couple of weeks. This gives them the freedom to bring out 2.6rc1 today, with the intention of brings 2.6rc2 out on Wednesday September 17 as originally planned, and hitting the October 1 final release date.
Since 3.0 isn't intended for production work I think this decision is the right one. There are still a few release-blocking issues on the 3.0 code, and there's little point trying to release it before quality is acceptable.
It will be great to see the next new release of Python. If you have any chance at all to test the release candidates you too can help to improve the quality of the eventual release.
Since 3.0 isn't intended for production work I think this decision is the right one. There are still a few release-blocking issues on the 3.0 code, and there's little point trying to release it before quality is acceptable.
It will be great to see the next new release of Python. If you have any chance at all to test the release candidates you too can help to improve the quality of the eventual release.
August 18, 2008
PyCon Is Coming ...
Incredibly, PyCon 2009 is already looming. The call for papers should be opening soon, and the conference needs volunteers like never before. I've just finished an article on that topic for Python Magazine, but that won't be published until November, so keep your eyes on the PyCon blog for more news.
Don't You Hate It ...
... when you [use a well-known search engine] for advice about a problem and the first hit is something you wrote several years ago? Either you should have remembered you've had that problem ever since you first wrote about it, or you should have remembered how to solve it.
Subscribe to:
Posts (Atom)