Oct-08-2021, 02:20 AM
(Oct-05-2021, 02:42 AM)Larz60+ Wrote: look at it this way
abs is a class of type builtin_function_or_method, abs(14) is an instance of class abs with attribute 14
>>> type(abs) <class 'builtin_function_or_method'> >>>type(abs(14)) # returns type of instance of abs (which is of class int) <class 'int'>
No, no! That's totally wrong!! abs is not a class. The type of abs is a class.
Anyhow, to see if a builtin is a class or not, you dont need to use type. Just write the name of the builtin and press enter.
>>> bytearray <class 'bytearray'>so bytearray is a class
>>> abs <built-in function abs>so abs is a builtin function
![Wall Wall](https://python-forum.io/images/smilies/eusa_wall.gif)
![Wall Wall](https://python-forum.io/images/smilies/eusa_wall.gif)
![Wall Wall](https://python-forum.io/images/smilies/eusa_wall.gif)
![Wall Wall](https://python-forum.io/images/smilies/eusa_wall.gif)
![Big Grin Big Grin](https://python-forum.io/images/smilies/biggrin.png)
![Big Grin Big Grin](https://python-forum.io/images/smilies/biggrin.png)
![Big Grin Big Grin](https://python-forum.io/images/smilies/biggrin.png)
![Big Grin Big Grin](https://python-forum.io/images/smilies/biggrin.png)