2 ms·
I'm starting to feel like a broken record here, but whenever anyone wants to pick in "str" I find myself compelled to point out: >>> type(str) <type 'type'
by bendotc 17y ago
I'm starting to feel like a broken record here, but whenever anyone wants to pick in "str" I find myself compelled to point out:
>>> type(str)
<type 'type'>
That is to say, str isn't a magical function, it's a type, and "str()" is how you call that type's constructor. How is this not somehow object oriented?
Of course, even if str was a function and not a constructor, it would be an object factory which delegates to its argument via a well defined interface (the __str__ method). OOP doesn't have to mean everything-is-an-object.