Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #90300
| From | Terry Reedy <tjreedy@udel.edu> |
|---|---|
| Subject | Re: anomaly |
| Date | 2015-05-10 13:09 -0400 |
| References | <CAMjeLr--RfnfgWc1hdOcHiEBpq3QwC7SZk-m14wM65JtpbgMLQ@mail.gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.320.1431277765.12865.python-list@python.org> (permalink) |
On 5/10/2015 12:34 PM, Mark Rosenblitt-Janssen wrote: > Here's something that might be wrong in Python (tried on v2.7): You are being hypnotized by the fact the 'int' is a builtin name. Builtin names are not keywords and can intentionally be rebound. If you rebind randomly, the result may seem strange, but is predictable. This is why be recommend not randomly reusing names of builtins. >>>> class int(str): pass This in effect rebinds 'int' to the str class. The work 'int' no longer has any connect to the builtin integer class. >>>> int(3) Equivalent to str(3) > '3' No surprise that str(3) == '3'. Replace 'int' with anything else, such as 'zyz' or 'Mark' in both statements and the result is the same. -- Terry Jan Reedy
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: anomaly Terry Reedy <tjreedy@udel.edu> - 2015-05-10 13:09 -0400
csiph-web