How to recover bytes function?

Ben Finney ben+python at benfinney.id.au
Thu Nov 13 18:37:57 EST 2014


satishmlmlml at gmail.com writes:

> file = open('data.bin', 'rb')
> bytes = file.read()

These are both terrible names, not least because they clobber the
built-in objects ‘file’ and ‘bytes’.

Don't name an object for *or not only for) its data type. Instead,
choose names that convey the *purpose* for the object.

-- 
 \         “Alternative explanations are always welcome in science, if |
  `\   they are better and explain more. Alternative explanations that |
_o__) explain nothing are not welcome.” —Victor J. Stenger, 2001-11-05 |
Ben Finney




More information about the Python-list mailing list