[issue16774] Additional recipes for itertools docs
Alexey Kachayev added the comment: It's hard to evaluate how popular given recipes, but: * drop is opposite to take, so it's as popular as take * the same situation with splitat, splitby - it's one case of partition that's hard to write each time with enumerator (partition is already in documentation) * takelast, droplast was added cause itertools.islice doesn't support negative indices (which is ok). both functions have not obvious implementation - I'm sure that recipes will be good example for users how to work with iterators even if concrete functions aren't so widely-spreaded -- ___ Python tracker <http://bugs.python.org/issue16774> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16774] Additional recipes for itertools docs
Alexey Kachayev added the comment: Updated patch with: * fix error in islice function name * made n=None default second argument for consume(iterator, n=None) cause it provides specific behavior when n is None which can be assumed as default for function -- Added file: http://bugs.python.org/file28768/itertools.doc.v3.diff ___ Python tracker <http://bugs.python.org/issue16774> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14373] C implementation of functools.lru_cache
Alexey Kachayev added the comment: Updated diff with: * fix object leaks * tp_clear * additional test for maxsize < 0 I also reimplemented multithreading test (fixed error and added skip rule). But actually, I'm not sure that it's enough for ensuring thread-safety of clear operation. I'm working on other variant now. I will be appreciated for any advice about where to find example of the same (or close enough) test cases from other modules. Regarding to previous comments from review. 1. "guard against negative numbers" I added special test case for negative maxsize in order to show, that now C version works the same as Python one. So, should we change both implementation? What behavior is most logical here? Reimplementation will change public API, so it's not only about acceleration. 2. Use regular PyObject instead of lru_list_elem. What the problems are with current implementation? -- Added file: http://bugs.python.org/file28498/14373.v9.diff ___ Python tracker <http://bugs.python.org/issue14373> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14373] C implementation of functools.lru_cache
Alexey Kachayev added the comment: Thread-safe implementation for cache cleanup. -- Added file: http://bugs.python.org/file28490/14373.v7.diff ___ Python tracker <http://bugs.python.org/issue14373> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16774] Additional recipes for itertools docs
Alexey Kachayev added the comment: Added: * takelast * droplast -- Added file: http://bugs.python.org/file28433/itertools.doc.v2.diff ___ Python tracker <http://bugs.python.org/issue16774> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16774] Additional recipes for itertools docs
New submission from Alexey Kachayev: Additional recipes for itertools documentation (widespread functions in other programming languages): * drop * split-at * split-by -- assignee: docs@python components: Documentation files: itertools.doc.diff keywords: patch messages: 178098 nosy: asvetlov, docs@python, kachayev priority: normal severity: normal status: open title: Additional recipes for itertools docs versions: Python 3.4 Added file: http://bugs.python.org/file28427/itertools.doc.diff ___ Python tracker <http://bugs.python.org/issue16774> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14373] C implementation of functools.lru_cache
Alexey Kachayev added the comment: Added additional Py_DECREF(s) for key and value. -- Added file: http://bugs.python.org/file28390/14373.v4.diff ___ Python tracker <http://bugs.python.org/issue14373> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14373] C implementation of functools.lru_cache
Alexey Kachayev added the comment: Fixed my previous patch according to all comments from review, except removing keyword arguments from lru_cache_new function. -- Added file: http://bugs.python.org/file28386/14373.v3.diff ___ Python tracker <http://bugs.python.org/issue14373> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14373] C implementation of functools.lru_cache
Alexey Kachayev added the comment: Serhiy, thank you for review. Working further on fixes. -- ___ Python tracker <http://bugs.python.org/issue14373> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14373] C implementation of functools.lru_cache
Alexey Kachayev added the comment: Updated patch with next points: * fix typedefs * python implementation works normally without C acceleration * test cases cover both python/c implementations * several style fixes in C module -- nosy: +kachayev Added file: http://bugs.python.org/file28369/14373.fixed.diff ___ Python tracker <http://bugs.python.org/issue14373> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16464] urllib.request: opener not resetting content-length
Alexey Kachayev added the comment: Fixed patch is attached. Documentation is updated. -- Added file: http://bugs.python.org/file28074/issue16464_fixed.diff ___ Python tracker <http://bugs.python.org/issue16464> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16464] urllib.request: opener not resetting content-length
Alexey Kachayev added the comment: This is special case for more "general" problem. When request is executed with HTTP client and data is not None, it calculates content length and adds special header to request. Then one can change request.data attribute value, but header "Content-length" is not changed in this case. Patch is attached. I implemented request.data as property and added method "remove_header" to deal problem. Test cases are also provided. -- keywords: +patch nosy: +kachayev Added file: http://bugs.python.org/file28015/issue16464.diff ___ Python tracker <http://bugs.python.org/issue16464> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16469] Exceptions raised by Fraction() different from those raised by int()
Alexey Kachayev added the comment: Ok, I think that ValueError is more appropriate and I have already attached adopted patch for issue 16483. -- ___ Python tracker <http://bugs.python.org/issue16469> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16483] Make int(float('inf')) raise ValueError rather than OverflowError.
Alexey Kachayev added the comment: Patch is attached (ported from full issue patch for issue 16469). -- keywords: +patch nosy: +kachayev Added file: http://bugs.python.org/file27993/issue16483.diff ___ Python tracker <http://bugs.python.org/issue16483> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16469] Exceptions raised by Fraction() different from those raised by int()
Changes by Alexey Kachayev : Added file: http://bugs.python.org/file27992/full_issues16469_fixed.diff ___ Python tracker <http://bugs.python.org/issue16469> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16469] Exceptions raised by Fraction() different from those raised by int()
Alexey Kachayev added the comment: I also attached "full_issue" patch: change OverflowError to ValueError for all cases. -- Added file: http://bugs.python.org/file27991/full_issues16469.diff ___ Python tracker <http://bugs.python.org/issue16469> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16469] Exceptions raised by Fraction() different from those raised by int()
Alexey Kachayev added the comment: Patch is attached for {float, Decimal} -> {int, Fraction} consistency (with ValueError and OverflowError). Test cases are changed as well. I can also change OverflowError to ValueError for all cases, but I'm not sure should I open for this separated issue or continue to work with this one. -- keywords: +patch nosy: +kachayev Added file: http://bugs.python.org/file27990/issue16469.diff ___ Python tracker <http://bugs.python.org/issue16469> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7317] Display full tracebacks when an error occurs asynchronously
Alexey Kachayev added the comment: Updated test case for traceback printing, fixed test_cmd_line crashing with new ignored exception message formatting (test was based on regular expression). Patch is attached. -- nosy: +kachayev Added file: http://bugs.python.org/file27853/issue7317.diff ___ Python tracker <http://bugs.python.org/issue7317> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16309] "PYTHONPATH=" different from no PYTHONPATH at all
Alexey Kachayev added the comment: Unit test added. pythonpath2.diff is included into issue16309.diff. -- nosy: +kachayev Added file: http://bugs.python.org/file27848/issue16309.diff ___ Python tracker <http://bugs.python.org/issue16309> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com