Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #75779

Re: TypeError: 'bytes' object is not callable error while trying to converting to bytes.

References <02baad14-39b1-41a0-a47d-28772c97ea54@googlegroups.com> <CAPTjJmqZdHdx7VJf7HMEUKe8J7uCH2HuKN1PO2i4azHygFGuDA@mail.gmail.com> <77C4289C-FBCD-449F-8460-B33029A4A236@gmail.com>
Date 2014-08-06 15:37 +1000
Subject Re: TypeError: 'bytes' object is not callable error while trying to converting to bytes.
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.12687.1407303433.18130.python-list@python.org> (permalink)

Show all headers | View raw


On Wed, Aug 6, 2014 at 3:31 PM, Travis Griggs <travisgriggs@gmail.com> wrote:
>> On Aug 4, 2014, at 22:57, Chris Angelico <rosuav@gmail.com> wrote:
>>
>> On Tue, Aug 5, 2014 at 3:47 PM, Satish ML <satishmlwizpro@gmail.com> wrote:
>>>>>> bytes = file.read()
>>
>> You've just shadowed the built-in type 'bytes' with your own 'bytes'.
>> Pick a different name for this, and you'll be fine. 'data' would work.
>
> Until python4 introduces the 'data' built in. :)

Python 3.6 could introduce that, no need to wait for Python 4. :)
However, it wouldn't be critical to this code, unless the builtin's
meaning is also wanted; it'd be on par with the shadowing of 'file'
earlier - given how rarely Python programs actually need 'file'
(rather than 'open'), it's not a big deal to shadow that one.

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

TypeError: 'bytes' object is not callable error while trying to converting to bytes. Satish ML <satishmlwizpro@gmail.com> - 2014-08-04 22:47 -0700
  Re: TypeError: 'bytes' object is not callable error while trying to converting to bytes. Ben Finney <ben+python@benfinney.id.au> - 2014-08-05 15:57 +1000
  Re: TypeError: 'bytes' object is not callable error while trying to converting to bytes. Chris Angelico <rosuav@gmail.com> - 2014-08-05 15:57 +1000
  Re: TypeError: 'bytes' object is not callable error while trying to converting to bytes. Travis Griggs <travisgriggs@gmail.com> - 2014-08-05 22:31 -0700
  Re: TypeError: 'bytes' object is not callable error while trying to converting to bytes. Chris Angelico <rosuav@gmail.com> - 2014-08-06 15:37 +1000

csiph-web