Abstraction in python
Abstraction in python
For example, when copying files:
import shutil shutil.copy('file.txt', 'copy.txt')
It is much more abstract (and simpler) to use the shutil library than:
with open(src, 'rb') as fsrc: with open(dst, 'wb') as fdst: while True: buf = fsrc.read(buf_size) if not buf: break fdst.write(buf)
Comments
Comments powered by Disqus