tweak some python's snippets

- in python2, class declaration should inherit other classes or object.
- rewrite a file idiom under the with statement
- fix with-snippets bound by open function