PythonCharmers / python-future

Easy, clean, reliable Python 2/3 compatibility
http://python-future.org
MIT License
1.18k stars 291 forks source link

Provide Python 2.6+ compatible count #152

Closed xZise closed 9 years ago

xZise commented 9 years ago

Could you make the _count function in future.types.newrange publicly available?

xZise commented 9 years ago

By the way I had already written an implementation for pywikibot when it was suggested that the future package should support it. So if you want to have tests you could use them from https://gerrit.wikimedia.org/r/#/c/219396/1/tests/tools_tests.py,cm

edschofield commented 9 years ago

Thanks for asking, Fabian.

This issue only relates to Py2.6. Python 2.7 and above already have an itertools.count() function with the step parameter.

I've now made the function available as future.backports.misc.count in the v0.14.x branch. This gets patched into itertools on Py2.6 by calling future.standard_library.install_aliases().

edschofield commented 9 years ago

Fixed in v0.15.0.

xZise commented 9 years ago

Ah the title may have been misleading. I wanted a “Python 2.7+ compatible count” IN Python 2.6 ;)