Closed myw closed 7 years ago
I agree, using jcamp with python 3.x is currently not possible when installed via pip due to the use of xrange instead of range, but it works with the latest version of jcamp from github. Thanks!
Just now updated the PyPI package. Sorry for the delay! I spent an absurd amount of time fighting with me computer trying to get around issues related to going through the proxy server that they require at my workplace. Eventually I gave up and decided to do the update from home.
Also note that this replaces xrange with range, so that it should be compatible with Python 3. I generally find the calls for always preferring xrange over range to be excessive. In many use cases it is extremely unlikely to exceed the upper limit of range -- the example here being the number of files imported by jcamp.
Probably doesn't matter much in this case, but FWIW, I think the calls for always preferring xrange
over range in Py2 were more often about efficiency rather than just the max upper limit: iterating through a range with xrange
avoids the unnecessary creation, memory copying, and subsequent destruction of an entire new list object, and instead essentially increments pointers. I've gotten over this issue in my code by using six
with from six.moves import range
. That way, range
behaves as it would in Py3, (which IMO is a better default behavior anyway) regardless of major version.
Misha - Thanks for the comment! Apparently I hadn't paid attention to the behavioral difference, with range being a conventional list and xrange being like a generator. I think the jcamp project is okay with keeping just "range" for now, so that users need not install "six" if they haven't already. But I think I can find some use for six.moves.range in other projects.
There have been new features added since the last release. It would be great to bump the version and release this new package to PyPI, to make dependency management easier.
Thank you!