anomaly
Mark Lawrence
breamoreboy at yahoo.co.uk
Sun May 10 13:21:42 EDT 2015
On 10/05/2015 17:48, Rustom Mody wrote:
> On Sunday, May 10, 2015 at 10:14:36 PM UTC+5:30, Ian wrote:
>> On Sun, May 10, 2015 at 10:34 AM, Mark Rosenblitt-Janssen wrote:
>>> Here's something that might be wrong in Python (tried on v2.7):
>>>
>>>>>> class int(str): pass
>>
>> This defines a new class named "int" that is a subclass of str. It has
>> no relation to the builtin class int.
>>
>>>>>> int(3)
>>> '3'
>>
>> This creates an instance of the above "int" class, which is basically
>> equivalent to calling "str(3)".
>>
>> Were you expecting a different result?
>
> In C (family) languages int is a keyword
> From that pov this is completely bizarre
>
This is a news group for a language called Python. Why do people keep
coming here expecting it to behave in the same way that (say) CORAL
66/250 does?
--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.
Mark Lawrence
More information about the Python-list
mailing list