with

The with clause works similar to a block in Ruby. This two snippeds are equivalent:

In Python:

with open('mi_fichero.txt', 'w') as f:
    f.write('Hola, mundo!')

In Ruby:

File.open('mi_fichero.txt', 'w') do |f|
  f.write('Hola, mundo!')
end

pass

It is used as a null operation, for example to define a function that does nothing

def f(arg): pass    # a function that does nothing (yet)

class C: pass       # a class with no methods (yet)

📌 StackOverflow

📌 Python Docs: pass

📌 Python Docs: with