jnweiger / pdfcompare

compare two PDF files, write a resulting PDF with highlighted changes
GNU General Public License v2.0
54 stars 16 forks source link

Import __future__ #5

Closed tomschr closed 8 years ago

tomschr commented 10 years ago

Not sure if this helps, but importing future can be useful, especially if you want to omit casting with float() as seen in https://github.com/jnweiger/pdfcompare/blob/master/pdfcompare.py#L235

from __future__ import division

Here is an example:

# without importing divison from __future__:
>>> 1/2
0
>>> float(1)/2
0.5
>>> from __future__ import division
>>> 1/2
0.5

For more information, see http://www.python.org/dev/peps/pep-0238/

jnweiger commented 8 years ago

Some float() casts remain, where FloatObjects need to perform math. (Especially those locations mentioned in https://github.com/jnweiger/pdfcompare/issues/5#issue-25096186 above. :unamused: ) Some int() casts added, where an integer division result is expected.