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

Ian Kelly ian.g.kelly at gmail.com
Mon Jan 18 12:00:28 EST 2016


On Mon, Jan 18, 2016 at 9:51 AM, Chris Angelico <rosuav at gmail.com> wrote:
> On Tue, Jan 19, 2016 at 3:28 AM, Charles T. Smith
>> 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.

What makes you think that it's a callable subclass? I don't see any
place in the posted transcript where int has been called.



More information about the Python-list mailing list