Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Oct 1st, 2006, 2:10 PM   #11
Dietrich
Professional Programmer
 
Dietrich's Avatar
 
Join Date: Feb 2005
Posts: 434
Rep Power: 4 Dietrich is on a distinguished road
SqLite sounds interesting, how do I get started using it?
Particularly the use as a data store.
__________________
I looked it up on the Intergnats!
Dietrich is offline   Reply With Quote
Old Oct 1st, 2006, 3:12 PM   #12
titaniumdecoy
Expert Programmer
 
titaniumdecoy's Avatar
 
Join Date: Nov 2005
Posts: 836
Rep Power: 3 titaniumdecoy is on a distinguished road
Send a message via AIM to titaniumdecoy
Could someone give me an example of how to use the "with" statement?
titaniumdecoy is offline   Reply With Quote
Old Oct 1st, 2006, 3:40 PM   #13
Arevos
Programming Guru
 
Arevos's Avatar
 
Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 4 Arevos is on a distinguished road
python Syntax (Toggle Plain Text)
  1. # Old way
  2. file = open("somefile")
  3. try:
  4. print file.readline(),
  5. finally:
  6. file.close()
  7.  
  8. # New way
  9. with open("somefile") as file:
  10. print file.readline(),
Essentially, the "with" block enables you to add an enter and exit clause to an object. In the case of the file object, the exit clause closes the file.

This has a number of advantages. Opening files is the obvious one, but any other type of IO operation also benefits. For instance, one could put a database cursor in a "with" block, and automatically have it rollback any operations if an exception occurs. Also, OpenGL has a lot of "StartSomething()" and "EndSomething()" functions that could be wrapped up in a with block.

So it's pretty neat. It makes your code easier to read, and ensures you never forget to properly close/rollback/stop an operation.
Arevos is offline   Reply With Quote
Old Oct 1st, 2006, 4:42 PM   #14
gnuvince
Newbie
 
Join Date: Oct 2006
Posts: 1
Rep Power: 0 gnuvince is on a distinguished road
One nice thing in 2.5 is the nice speed improvements. A lot of my scripts execute more than twice as fast!
gnuvince is offline   Reply With Quote
Old Oct 10th, 2006, 9:36 PM   #15
Game_Ender
Professional Programmer
 
Game_Ender's Avatar
 
Join Date: May 2006
Location: Maryland, USA
Posts: 306
Rep Power: 3 Game_Ender is on a distinguished road
Quote:
Originally Posted by Jessehk View Post
I'm wating for the .deb . I did download the source and make'ed it so I could test the new features, but I never make install'ed.

I was even prepared to make my own package, but I was quickly overhwhelmed.
Just use your good friend checkinstall, run "sudo checkinstall" instead of "sudo make install" and you should have package reading to install (and remove) at your leisure.
Game_Ender is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[tutorial] Python for programming beginners coldDeath Python 30 Dec 14th, 2005 11:35 AM
If you want to learn Python or improve your Python skills coldDeath Python 2 Nov 23rd, 2005 12:27 AM
Convert Python script to C++ code clanotheduck Python 17 Sep 25th, 2005 8:55 AM
Advanced Python Tricks Arevos Python 19 Sep 24th, 2005 7:39 AM
Python - A Programmers Introduction coldDeath Python 17 Aug 19th, 2005 12:41 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 6:47 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC