O'Reilly logo
  • Chris Kang thinks this is interesting:

with tt: ...statements printing output to be enclosed in a matched open/close `sometag` pair


Cover of Python in a Nutshell, 3rd Edition


"with tt" will call enter in tt, which has been created with 'sometag' initializer. This will print the open tag. After ".....statement.." is run, tt will call exit. This will print the close tag.