[issue42240] Add Maxheap version of a heappush into heapq module

2020-12-04 Thread Matteo Dell'Amico
Matteo Dell'Amico added the comment: Personally, I'd find a maxheap in the standard library helpful, and a quick Google search tells me I'm not alone. I generally have to deal with numeric values, so I have these choices: - ugly code (e.g., `minus_distance, elem = heappop(he

[issue38200] Adding itertools.pairwise to the standard library?

2019-10-01 Thread Matteo Dell'Amico
Matteo Dell'Amico added the comment: Sorry for taking so long to answer, I didn't see notifications somehow. Raymond, my use case is in general something that happens when I'm doing analytics on sequences of events (e.g., URLs visited by a browser) or paths in a graph. I lo

[issue38200] Adding itertools.pairwise to the standard library?

2019-09-17 Thread Matteo Dell'Amico
New submission from Matteo Dell'Amico : I use itertools.pairwise all the time and I wonder if the same happens to others. I'm thinking that others may be in the same situation, and having this simple recipe already included in the library would be definitely more convenient than co

[issue24068] statistics module - incorrect results with boolean input

2015-05-20 Thread Matteo Dell'Amico
Changes by Matteo Dell'Amico : -- nosy: +della ___ Python tracker <http://bugs.python.org/issue24068> ___ ___ Python-bugs-list mailing list Unsubscr

[issue5867] No way to create an abstract classmethod

2009-04-28 Thread Matteo Dell'Amico
New submission from Matteo Dell'Amico : Is there a way to define an abstract classmethod? The two obvious ways don't seem to work properly. Python 3.0.1+ (r301:69556, Apr 15 2009, 17:25:52) [GCC 4.3.3] on linux2 Type "help", "copyright", "credits" or &q

[issue5647] MutableSet.__iand__ implementation calls self.discard while iterating on self

2009-04-01 Thread Matteo Dell'Amico
Matteo Dell'Amico added the comment: I suggest solving the problem by changing the implementation to: def __iand__(self, c): self -= self - c: or to def __iand__(self, c): for item in self - c: self.discard(item) -- ___ P

[issue5647] MutableSet.__iand__ implementation calls self.discard while iterating on self

2009-04-01 Thread Matteo Dell'Amico
New submission from Matteo Dell'Amico : The current MutableSet.__iand__ implementation calls self.discard while iterating on self. This creates strange problems while implementing MutableSet with simple choices. For example, consider the attached file which implements set by delegating eith

[issue5350] Modification to "pairwise" in itertools recipes

2009-02-23 Thread Matteo Dell'Amico
Matteo Dell'Amico added the comment: great Raymond! :) ___ Python tracker <http://bugs.python.org/issue5350> ___ ___ Python-bugs-list mailing list Unsubsc

[issue5352] Missing 'non overlapping' clause in str.count documentation

2009-02-23 Thread Matteo Dell'Amico
New submission from Matteo Dell'Amico : The str.count (http://docs.python.org/dev/py3k/library/stdtypes.html) documentation does not report that it returns the number of *non-overlapping* instances. For example, I expected 'aaa'.count('aa') to be 2 and not 1. Compare th

[issue5350] Modification to "pairwise" in itertools recipes

2009-02-23 Thread Matteo Dell'Amico
Matteo Dell'Amico added the comment: Georg, you're right, there's a StopIteration to catch. My thinko was mistaking the function for a generator where the exception propagation would have done the right thing. The amended version now becomes next(b) for x, y in zip(a, b): yield

[issue5350] Modification to "pairwise" in itertools recipes

2009-02-23 Thread Matteo Dell'Amico
New submission from Matteo Dell'Amico : I feel that the "pairwise" recipe could be slightly more elegant if "for elem in b: break" became a simpler next(b) (or b.next() for Python 2.x). It is also more natural to modify the recipes to suit one's needs (e.g., re