I am kind of new to Python, so I am trying to read over existing code. I am a little confused on the syntax of this though.
For example:
rlist, _, _ = select.select(sockets, [], [])
I understand that select.select()
takes 3 lists (and I assume []
just means empty list), but is the _
used to denote a placeholder of some sort?
It's just the name of a variable! Usually people use _
for variables that are temporary or insignificant.
As other people have stated, _
is a common alias for gettext, a translation library. You can identify when it's being used as gettext if you see it called as a function, eg. _('Hello, world!')
.
Protip: In the python console it can be used to retrieve the result of the last statement.
>>> 3 + 4
7
>>> a = _
>>> print a
7
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