[issue26082] functools.lru_cache user specified cachedict support
New submission from Chiu-Hsiang Hsu: Currently, lru_cache will automatically construct a Python dictionary in the function as cachedict. IMHO, it will be much more flexible to let users specified their cachedict, so they can use any kind of dict-like calss as their cachedict. Thus, users can use any dictionary implementation and save result in any form they want. for example : use OrderedDict .. code-block:: python from functools import lru_cache from collections import OrderedDict @lru_cache(maxsize=None, cache=OrderedDict()) def func(*args, **kwargs): pass save by pickle .. code-block:: python import os import pickle from functools import lru_cache filename = "cache.pickle" cache = {} def load_cache(): global cache if os.path.isfile(filename): with open(filename, "rb") as f: cache = pickle.load(f) def store_cache(): with open(filename, "wb") as f: pickle.dump(cache, f) load_cache() @lru_cache(maxsize=None, cache=cache) def func(*args, **kwargs): pass -- components: Library (Lib) files: functools.lru_cache-user-specified-cachedict.patch keywords: patch messages: 258001 nosy: wdv4758h priority: normal severity: normal status: open title: functools.lru_cache user specified cachedict support type: enhancement versions: Python 3.6 Added file: http://bugs.python.org/file41584/functools.lru_cache-user-specified-cachedict.patch ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26082> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue25804] Make Profile.print_stats support sorting by mutiple values
Chiu-Hsiang Hsu added the comment: Attached refactored patch with tests. -- Added file: http://bugs.python.org/file41249/print_stats_with_test.patch ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25804> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20210] Provide configure options to enable/disable Python modules and extensions
Changes by Chiu-Hsiang Hsu <wdv47...@gmail.com>: -- nosy: +wdv4758h ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue20210> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue25804] Make Profile.print_stats support sorting by mutiple values
New submission from Chiu-Hsiang Hsu: Currently, the result of profile.run can not easily sort by mutiple values with "sort" keyword argument. Following code will work with this patch. >>> import cProfile >>> cProfile.run('42**42', sort=('tottime', 'stdname')) 3 function calls in 0.000 seconds Ordered by: internal time, standard name ncalls tottime percall cumtime percall filename:lineno(function) 10.0000.0000.0000.000 {built-in method builtins.exec} 10.0000.0000.0000.000 :1() 10.0000.0000.0000.000 {method 'disable' of '_lsprof.Profiler' objects} >>> import cProfile >>> cProfile.run('42**42', sort=('tottime', 'stdname')) 3 function calls in 0.000 seconds Ordered by: internal time, standard name ncalls tottime percall cumtime percall filename:lineno(function) 10.0000.0000.0000.000 {built-in method builtins.exec} 10.0000.0000.0000.000 :1() 10.0000.0000.0000.000 {method 'disable' of '_lsprof.Profiler' objects} >>> import profile >>> profile.run('42**42', sort=('tottime', 'stdname')) 4 function calls in 0.000 seconds Ordered by: internal time, standard name ncalls tottime percall cumtime percall filename:lineno(function) 10.0000.0000.0000.000 profile:0(42**42) 10.0000.0000.0000.000 :0(exec) 10.0000.0000.0000.000 :0(setprofile) 10.0000.0000.0000.000 :1() 00.000 0.000 profile:0(profiler) -- components: Library (Lib) files: print_stats.patch keywords: patch messages: 255935 nosy: wdv4758h priority: normal severity: normal status: open title: Make Profile.print_stats support sorting by mutiple values type: enhancement versions: Python 3.6 Added file: http://bugs.python.org/file41247/print_stats.patch ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25804> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24774] inconsistency in http.server.test
Chiu-Hsiang Hsu added the comment: I'm not quite sure we should put argument parsing back into the test() function or just fix docstring. It already expose port and bind through function arguments. It looks wierd to me to have function arguments CLI arguments modifying the same variable in the same time. If we want to move argument parsing back, I think we should clean the function parameters. In this way, the docstring of test function still need some update, though. (we have much more CLI arguments now) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24774 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com