I many times had a need to do a try/finally in Python as well as catch exceptions. This always ended up with sub-trys:
try:
try:
oh()
except Blah:
how()
finally:
lame()
I'm happy to find out that Python 2.5 will now allow both except and finally to be used together. Even cooler is the with statement. No more needing to write boilerplate acquire/release thread locking code, but rather simply:
lock = threading.Lock()
with lock:
# Critical section of code
...
Cool, automatic acquire and release. Checkout the What's New in Python 2.5, as it also contains other neat things. There is also a video of a talk Guido gave at work about Python 3000, which I unfortunately missed
.
Btw, I used tinyurl here because of the gayness of my webhosting provider. They are blocking any http post strings containing "/fev/" (replace fev with dev) with mod_security as if this somehow makes the site more secure.
Donate to keep this site going!
| Mon | Tue | Wed | Thu | Fri | Sat | Sun |
|---|---|---|---|---|---|---|
| << < | > >> | |||||
| 1 | 2 | 3 | ||||
| 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| 11 | 12 | 13 | 14 | 15 | 16 | 17 |
| 18 | 19 | 20 | 21 | 22 | 23 | 24 |
| 25 | 26 | 27 | 28 | 29 | 30 | |