esdalmaijer / PyGaze

an open-source, cross-platform toolbox for minimal-effort programming of eye tracking experiments
www.pygaze.org
GNU General Public License v3.0
671 stars 211 forks source link

Increase PsychoPyMouse efficiency #2

Closed esdalmaijer closed 10 years ago

esdalmaijer commented 11 years ago

https://github.com/esdalmaijer/PyGaze/blob/master/pygaze-0.4/libinput.py#L452

for b in range(0,len(pressed)):
    if pressed[b] == 1:
        if mousebuttonlist == None or b+1 in mousebuttonlist:
            return b+1, self.get_pos(), time

Entire for loop could be replaced by:

return pressed.index(1)+1, self.get_pos(), time
esdalmaijer commented 10 years ago

Decided against this, since I forgot to take into account the mousebuttonlist for the alternative option. This would require some array logics or another for loop, therefore simplifying nothing.