I was playing with the type()
method in Python, and came across this:
>>> type(_)
<type 'type'>
The 'type' of the underscore( _ ) character is type
itself. What does that even mean?
Inside python interpreter, _
is a special variable that returns output from previous line, so depending on the last line type of that variable value could be different.
For example,
>>> type(_)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name '_' is not defined
>>> 1
1
>>> type(_)
<type 'int'>
>>> type(_)
<type 'type'>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With