Not logged in
Log in now
Create an account
Subscribe to LWN
LWN.net Weekly Edition for December 5, 2013
Deadline scheduling: coming soon?
LWN.net Weekly Edition for November 27, 2013
ACPI for ARM?
LWN.net Weekly Edition for November 21, 2013
The C# 'using' statement?
PyCon: Evangelizing Python
Posted Apr 2, 2013 17:06 UTC (Tue) by hummassa (subscriber, #307)
Posted Apr 2, 2013 17:23 UTC (Tue) by intgr (subscriber, #39733)
1. Python's "with" statement is more flexible, it has access to the exception when it occurs. A "with db_transaction():" block can automatically decide to commit or roll back, unlike C++/C#. You can also implement something like "with ignore_exception(OSError):"
2. Python doesn't require you to create a local variable to hold the state; this always annoys me when using the RAII pattern to hold locks in C++.
3. Prettier syntax ;)
Posted Apr 2, 2013 19:13 UTC (Tue) by hummassa (subscriber, #307)
Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds