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


Groups > comp.lang.python > #101879

Re: When is an int not an int? Who can explain this?

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Subject Re: When is an int not an int? Who can explain this?
Date Tue, 19 Jan 2016 03:51:29 +1100
Lines 50
Message-ID <mailman.90.1453135892.15297.python-list@python.org> (permalink)
References <n7j2r0$hc4$1@dont-email.me> <mailman.89.1453134008.15297.python-list@python.org> <n7j3s1$hc4$2@dont-email.me>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
X-Trace news.uni-berlin.de 2JSNvsGTXbNj3yPcn0FMUAjpZ3hhdIg1gJknt35mlDgQ==
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.006
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'received:209.85.223': 0.03; 'type,': 0.07; 'cc:addr:python-list': 0.09; 'imported': 0.09; 'int.': 0.09; 'subclass': 0.09; 'jan': 0.11; 'subject:not': 0.11; "hasn't": 0.15; "'int'": 0.16; '(barring': 0.16; '(float)': 0.16; '(int)': 0.16; '2016': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'literals': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'string': 0.17; 'basically': 0.18; 'first.': 0.18; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'suggested': 0.20; 'file.': 0.22; 'pass': 0.22; 'am,': 0.23; "haven't": 0.24; 'header:In-Reply- To:1': 0.24; 'module': 0.25; 'chris': 0.26; 'checking': 0.27; 'order.': 0.27; 'possibility': 0.27; 'question': 0.27; 'message- id:@mail.gmail.com': 0.27; 'callable': 0.29; 'there!': 0.29; "i'd": 0.31; 'probably': 0.31; 'though,': 0.32; 'curious': 0.33; 'tue,': 0.34; 'received:google.com': 0.35; 'next': 0.35; 'but': 0.36; 'should': 0.36; 'received:209.85': 0.36; 'possible': 0.36; 'loaded': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'received:209': 0.38; 'why': 0.39; 'where': 0.40; 'still': 0.40; 'your': 0.60; 'information,': 0.61; 'more': 0.63; 'now:': 0.72; 'smith': 0.76; '#1:': 0.84; '#2:': 0.84; '*really*': 0.84; 'chrisa': 0.84; 'start.': 0.84; 'subject:When': 0.84; 'subject:this': 0.85; 'to:none': 0.91; 'armed': 0.91; 'subject:Who': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=K8AUr81pfp0a8VgX4SrkiHs4glhx/IRzIpOqhlPdIUQ=; b=xlG+GlEuN8Y2V3Eox8aCtjpAU2A51cHE/qBbfPGiUNJMPtbJsm4dLF+2Gekv3G9+5z 1vKwr/eRdnIvs2nemKEMJ/xpJ8M49s4p7FVtScJnjad6IiLSv0myeuBmE3qcaCaVhKip f9PWi6Ih2TdFKzi5G76Rka0q3AyYxTSmRpOVSHIp5q9TNo4z2zD2pP7uGpgd3bDaBKLV XuxeLeA6dgTQitPHO1cLfsTDeVt+lpKHjZ9+siu1/NW9V0GibgMV1pbl6FQZakpiUh4d ddkwlDpLzf52jXMfI9ejNe1PftutvkpWA7to/EGb5+nqeawlGIzFAviDc0JjfY5T0oUL 9lmA==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:cc:content-type; bh=K8AUr81pfp0a8VgX4SrkiHs4glhx/IRzIpOqhlPdIUQ=; b=HMiqU3JAwrFHbYb8QbssJIja8pR2pB1os91rvMgQoE6rQd8I/f95oYhIIoxoj8eMqm 2UbY6EEqhh49GHax0alazM0VXxsqe9L/xaACuLkrZ9lCcnhrvKJA5y8nDp92+OytUuY7 xzxG3zzysozGi4lidpWAeUd8Dac5pvO356flA1OeArErjM6UCn3NcmCvY/QB/xM2S3FR ARkblWUHwNj5fX2UeQ4szBzl6xr8rJd5jwJozZnOdjlABrQvXuwOGFgj+gyBLZfktaf3 bWhl6hIlnHRAXAhXertacbOlQNOj4qMfSQUeeTemc1b0HExBLFWZH/Gx5QOtRBinlifF KhDQ==
X-Gm-Message-State ALoCoQkiABhEeHe9NPUsO5L5LFi3Re4tZiH0r42fq6giMkKZazayLMcxLHIcvWl5C0vG4i1ocQ+3y2h03s/Z8CFm5dqH3bL4dg==
X-Received by 10.107.14.73 with SMTP id 70mr22035338ioo.31.1453135890044; Mon, 18 Jan 2016 08:51:30 -0800 (PST)
In-Reply-To <n7j3s1$hc4$2@dont-email.me>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Xref csiph.com comp.lang.python:101879

Show key headers only | View raw


On Tue, Jan 19, 2016 at 3:28 AM, Charles T. Smith
<cts.private.yahoo@gmail.com> wrote:
> On Tue, 19 Jan 2016 03:19:59 +1100, Chris Angelico wrote:
>> Possibility #1: 'int' has been rebound.
>>
>> Possibility #2: 'type' has been rebound.
>>
>> I'd check them in that order.
>>
>> ChrisA
>
>
> But:
>
> (PDB)p 5 + 0
> 5

That shows that your literals haven't changed. They basically never
will (barring *really* crazy shenanigans).

> (PDB)class c (object): pass
> (PDB)type (c()) is c
> True

And this shows that the name 'type' probably hasn't changed. It's
still possible that it's not the normal 'type' type, but far more
likely that it's 'int' that got rebound, which is why I suggested
checking for that first.

> Okay, I think I understand it now:
>
> (PDB)type (int)
> <type 'module'>
>
> (PDB)type (float)
> <type 'type'>

And that's pretty strong evidence right there! So the next question
is... what got imported under the name 'int'?

int.__name__ will be a start. If that just returns the string 'int',
then try int.__package__ which might give a hint. Also, int.__file__
will tell you where it was loaded from, if it was indeed loaded from a
file.

Armed with that information, you should be able to track down what's
going on. It's curious, though, that you have a callable subclass of
module bound to the name int. Very curious indeed.

ChrisA

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


Thread

When is an int not an int?  Who can explain this? "Charles T. Smith" <cts.private.yahoo@gmail.com> - 2016-01-18 16:11 +0000
  Re: When is an int not an int? Who can explain this? Chris Angelico <rosuav@gmail.com> - 2016-01-19 03:19 +1100
    Re: When is an int not an int? Who can explain this? "Charles T. Smith" <cts.private.yahoo@gmail.com> - 2016-01-18 16:28 +0000
      Re: When is an int not an int? Who can explain this? Chris Angelico <rosuav@gmail.com> - 2016-01-19 03:51 +1100
      Re: When is an int not an int? Who can explain this? Ian Kelly <ian.g.kelly@gmail.com> - 2016-01-18 10:00 -0700
      Re: When is an int not an int? Who can explain this? Random832 <random832@fastmail.com> - 2016-01-18 12:02 -0500
      Re: When is an int not an int? Who can explain this? Chris Angelico <rosuav@gmail.com> - 2016-01-19 04:35 +1100

csiph-web