learning python ...

hw hw at adminart.net
Mon May 24 01:31:37 EDT 2021


PS:

On 5/24/21 7:20 AM, hw wrote:
> There is even no indication from the output from the program before it 
> aborts with an error message that something might be wrong:  For 
> 'type(float)', it prints "<class 'float'>" just like it does for int. 
> How is anyone supposed to debug stuff like that?

Ok, it prints "<class 'type'>" for type(str) when str hasn't been defeated.

But still:


#!/usr/bin/python

foo = 0
print(type(int))
print(type(float))
print(type(foo))
print(type(str))
type = 4
print(type(str))


line 9, in <module>
     print(type(str))
TypeError: 'int' object is not callable


How is this /not/ bad?  It seems like a no-go for any programming 
language that isn't designed for the programmer to shoot into thier own 
feet.


More information about the Python-list mailing list