bobjacobsen / python-openlcb

MIT License
2 stars 1 forks source link

Review use of division to account for dynamic Python 3 behaviors and differences between `/` and `//` #8

Closed Poikilos closed 5 months ago

Poikilos commented 5 months ago

Consider using Python 3 floor division (Python 2 support can be added via from __future__ import division at top of file). nSegments = int((len(data)+5) / 6) # the +5 is since integer division takes the floor value would become: nSegments = (len(data)+5) // 2 # +5 ensures enough space after floor division (note that in Python 3, / would produce a float regardless of type given, where Python 2 would produce an int if dividing ints).