Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unknown Python Syntax

Tags:

python

syntax

I've found the following syntax in a python file:

 units = (
        (100, 1 << 30, _('%.0f GB')),
        (10, 1 << 30, _('%.1f GB')),
        (1, 1 << 30, _('%.2f GB')),
        (100, 1 << 20, _('%.0f MB')),
        (10, 1 << 20, _('%.1f MB')),
        (1, 1 << 20, _('%.2f MB')),
        (100, 1 << 10, _('%.0f KB')),
        (10, 1 << 10, _('%.1f KB')),
        (1, 1 << 10, _('%.2f KB')),
        (1, 1, _('%.0f bytes')),
        )

Does anyone know for what this underscore stands for?

Thanks in advance.

like image 991
rudimenter Avatar asked May 05 '26 09:05

rudimenter


1 Answers

Underscore is a valid variable name, so you have to look at the context of your example code. Obviously the underscore is a method which has been defined somewhere else. Usually it's used for translation stuff or similar things.

like image 140
Achim Avatar answered May 06 '26 21:05

Achim



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!