[Python-Dev] "begin" as keyword for pep 340

Adam Souzis adamsz at gmail.com
Wed May 4 18:41:02 CEST 2005


I'm a bit surpised that no one has yet [1] suggested "begin" as a
keyword instead "block" as it seems to express the intent of blocks
and is concise and readable.  For example, here are the examples in
PEP 340 rewritten using "begin":

begin locking():
   ...

begin opening(path) as f: #how about: begin using_file(path) as f:
   ...

begin transaction(db):
  ... 

begin auto_retry(3):
   ...

begin redirecting_stdout:
  ....

Probably the biggest problem with "begin" is that it is relatively
common as an identify. For example, Greping through Python's Lib
directory, begin is used as a method name twice (in httplib and
idlelib.pyshell) and as a local twice (in mhlib and pyassemb).

However, i can't think of many instances where there would be
ambiguity in usage -- could 'begin' be a pseudo-identifier like "as"
for some transitional time?

-- adam

[1] (Or maybe GMail's search has failed me ;)


More information about the Python-Dev mailing list