How to recover bytes function?

Cameron Simpson cs at
Fri Nov 14 08:46:09 CET 2014

On 13Nov2014 14:32, satishmlmlml at <satishmlmlml at> wrote:
>file = open('data.bin', 'rb')
>bytes =
>records = [bytes([char] * 8) for char in b'spam']
>TypeError: 'bytes' object is not callable
>How to recover bytes function?

The best way is not to use "bytes" for something else when you know you will be 
using the builtin version as well. Using the same name for two things is 
generally a bad idea.

The second, and worse, way is to see the documentation for the "builtins" 

Cameron Simpson <cs at>

Madness takes its toll.  Please have exact change.
        - Janice Hanes <janice at>

More information about the Python-list mailing list