473,395 Members | 1,680 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Dr Dobbs "with" keyword

In the March 2005 issue of Dr Dobbs Journal there is an article
"Resource Management in Python" by Oliver Schoenborn. One paragraph
(first new paragraph, page 56) starts "Starting with Python 2.4, a new
type of expression lets you use the keyword /with/". It continues,
mentioning PEP 310 (Reliable Acquisition/Release Pairs) which is at
"Draft" status and unlikely to be accepted with the keyword "with" as
Guido wants to use that for another purpose. The discussion of cyclic
garbage also troubles me but is not an area in which I have much
experience.

While publishing a correction in a future issue would not be very
helpful, adding a correction to online and CD-ROM versions would be. If
anyone understands the technical review process at DDJ, could they give
them a little prod.

Neil
Jul 19 '05 #1
1 1684
Neil Hodgson wrote:
In the March 2005 issue of Dr Dobbs Journal there is an article
"Resource Management in Python" by Oliver Schoenborn. One paragraph
(first new paragraph, page 56) starts "Starting with Python 2.4, a new
type of expression lets you use the keyword /with/". It continues,
mentioning PEP 310 (Reliable Acquisition/Release Pairs) which is at
"Draft" status and unlikely to be accepted with the keyword "with" as
Guido wants to use that for another purpose.


Whatever keyword is chosen, I hope PEP 310 eventually hit Python, I have been
awaiting it for a long time. I would also like to have a builtin resource()
like this:

def resource(enter_call, exit_call):
class Res(object):
__enter__ = lambda self: enter_call()
__exit__ = lambda self: exit_call()
return Res()

with resource(self.mutex.lock, self.mutex.unlock):
pass

Either that, or "with" could call adapt() implicitly so I can register my
conversion functions.
--
Giovanni Bajo
Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: news | last post by:
I am pretty new to Java and I just install the JDK1.4.2 03 I am getting an error when I run the class file TestChart.class with the java.exe: Exception in thread "main"...
23
by: Invalid User | last post by:
While trying to print a none empty list, I accidentaly put an "else" statement with a "for" instead of "if". Here is what I had: if ( len(mylist)> 0) : for x,y in mylist: print x,y else:...
68
by: Marco Bubke | last post by:
Hi I have read some mail on the dev mailing list about PEP 318 and find the new Syntax really ugly. def foo(x, y): pass I call this foo(1, 2), this isn't really intuitive to me! Also I...
29
by: Alexander Mahr | last post by:
Dear Newsgroup, I'm somehow confused with the usage of the static keyword. I can see two function of the keyword static in conjunction with a data member of a class. 1. The data member...
9
by: Paul Brownjohn | last post by:
Hello I am new both to this group and to C# programming having spent the last 15 years or so writing C and VB. You will forgive I hope if I am asking the totally obvious but it is a question...
4
by: Philipp Sumi | last post by:
Hello all I have a thread that performs some simple I/O within a loop that runs on a separate thread. I used the using keyword to ensure the writer's disposal: using (writer) { while...
25
by: samjnaa | last post by:
Please check for sanity and approve for posting at python-dev. In Visual Basic there is the keyword "with" which allows an object- name to be declared as governing the following statements. For...
24
by: carnold | last post by:
Hello, I'm a developer coming from C++ and Java ... I've going thru "Effective C#" (which highly recommend for people coming from other languages wanting to learn C#), and it states that "value...
4
by: FullBandwidth | last post by:
I have been perusing various blogs and MSDN pages discussing the use of event properties and the EventHandlerList class. I don't believe there's anything special about the EventHandlerList class in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.