reset password
Author Message
rabbott
Posts: 1649
Posted 09:07 Nov 18, 2018 |

Those of you working on Capture-the-Flag may be interested in a Python feature that lets you overload operators.

Line 114 of baselineTeam.py includes: features * weights.

Python implements the * operator with the __mul__ method.

features and weights are both Counters. Counters are defined in util.py file. The Counter class defined its own __mul__ method on line 332.

For additional discussion and explanation, see Python Operator Overloading and Emulating Numeric Types in the Python documentation.

 

Last edited by rabbott at 09:13 Nov 18, 2018.