[issue19737] Documentation of globals() and locals() should be improved

2013-11-23 Thread Zahari Dim
New submission from Zahari Dim: The globals() notification states: Return a dictionary representing the current global symbol table.[...] This doc and the fact that globals() is called as a function made me think that globals() returns a copy of the global namespace dict, rather than

[issue19737] Documentation of globals() and locals() should be improved

2013-11-23 Thread Zahari Dim
Zahari Dim added the comment: I am looking at the docs of the built-in functions: http://docs.python.org/2/library/functions.html -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19737

[issue24500] contextlib.redirect_stdout should redirect C output

2015-06-24 Thread Zahari Dim
Changes by Zahari Dim zaha...@gmail.com: -- title: xontextlib.redirect_stdout should redirect C output - contextlib.redirect_stdout should redirect C output ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24500

[issue24500] xontextlib.redirect_stdout should redirect C output

2015-06-24 Thread Zahari Dim
New submission from Zahari Dim: It is common to have an inflexible C wrapper with lots of undesired output. However it is not so trivial to supress (or redirect) that output from Python in a selective way. contextlib.redirect_stdout doesn't help, since it only changes sys.sdout, without

[issue24475] The docs never define what a pool task is

2015-06-19 Thread Zahari Dim
New submission from Zahari Dim: See: http://stackoverflow.com/questions/30943161/multiprocessing-pool-with-maxtasksperchild-produces-equal-pids The documentation never makes clear what a task in the context of Pool.map. At best, it says: This method chops the iterable into a number of chunks

[issue24519] multiprocessing.Pool with maxtasksperchild starts too many processes

2015-06-27 Thread Zahari Dim
New submission from Zahari Dim: The following example should start two processes, but instead it starts three, even though only two do_work(). A third process is incorrectly started after the first one finishes. import os import time from multiprocessing import Pool def initprocess

[issue24519] multiprocessing.Pool with maxtasksperchild starts too many processes

2015-06-27 Thread Zahari Dim
Changes by Zahari Dim zaha...@gmail.com: -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24519 ___ ___ Python-bugs-list

[issue24500] provide context manager to redirect C output

2015-06-26 Thread Zahari Dim
Zahari Dim added the comment: Well, the simple minded example I posted has so many bugs (many of which I don't understand, for example why it destroys the stdout of an interpreter permanently) that I really think this feature is necessary

[issue24500] provide context manager to redirect C output

2016-06-02 Thread Zahari Dim
Zahari Dim added the comment: Considering Python is used often to interact with lower level languages, it seems interesting to have the ability to control the "real" standard output and error that those languages use. Note that redirecting to /dev/null is only one possible a

[issue27399] ChainMap.keys() is broken

2016-06-27 Thread Zahari Dim
New submission from Zahari Dim: When trying to see if the keys() of a collections.ChainMap object are empty, it tries to compute the hash of the dicts that compose the ChainMap, giving rise to an error: In [1]: from collections import ChainMap In [2]: m = ChainMap([{'a':1}, {'b':2}]) In [3

[issue27399] ChainMap.keys() is broken

2016-06-27 Thread Zahari Dim
Changes by Zahari Dim <zaha...@gmail.com>: -- resolution: -> not a bug status: open -> closed ___ Python tracker <rep...@bugs.python.org> <http://bugs.

[issue13349] Non-informative error message in index() and remove() functions

2017-04-26 Thread Zahari Dim
Changes by Zahari Dim <zaha...@gmail.com>: -- pull_requests: +1418 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue13349> ___ _

[issue34586] collections.ChainMap should have a get_where method

2018-09-05 Thread Zahari Dim
New submission from Zahari Dim : When using ChainMap I have frequently needed to know the mapping inside the list that contains the effective instance of a particular key. I have needed this when using ChainMap to contain a piece of configuration with multiple sources, like for example

[issue34586] collections.ChainMap should have a get_where method

2018-09-06 Thread Zahari Dim
Zahari Dim added the comment: I believe an argument for including this functionality in the standard library is that it facilitates writing better error messages and thus better code. Some results that are returned when one searches for *python ChainMap* are: - <https://stackoverflow.

[issue34586] collections.ChainMap should have a get_where method

2018-09-07 Thread Zahari Dim
Zahari Dim added the comment: > ISTM that this is the wrong stage to perform validation of allowable values. > That should occur upstream when the underlying mappings are first created. > At that earlier stage it possible to give a more timely response to erroneous

[issue34586] collections.ChainMap should have a get_where method

2018-09-08 Thread Zahari Dim
Zahari Dim added the comment: On Sat, Sep 8, 2018 at 1:15 PM Serhiy Storchaka wrote: > > > Serhiy Storchaka added the comment: > > I concur with Raymond. The purpose of ChainMap is providing a mapping that > hides the implementation detail of using several mappings as fa

[issue34586] collections.ChainMap should have a get_where method

2018-09-11 Thread Zahari Dim
Zahari Dim added the comment: > > I've discussed this with other core devs and spent a good deal of time > evaluating this proposal. I'm going to pass on the this one but do think it > was a inspired suggestion. Thank you for the proposal. Thank you for taking the time to co

[issue17005] Add a topological sort algorithm

2020-01-19 Thread Zahari Dim
Zahari Dim added the comment: I would like to suggest a `dependency_resolver` API that I have been using that goes in line with what Tim Peters proposes in https://bugs.python.org/issue17005#msg359702 A DAG would be an object that can be iterated in topological order with __iter__