[issue40047] itertools.tee does not release resources during iteration?

2020-03-23 Thread Peter Würtz

New submission from Peter Würtz :

Itertools `tee` does not seem to de-reference yielded items, even after 
consumption of all items from all tee-iterators.

According to the documentation (to my understanding), there shouldn't be any 
extra memory requirement as long as the tee-iterators are consumed in a 
balanced way. I.e. after an item was pulled from all iterators there shouldn't 
be any residual reference to it.

This is true for the example-implementation mentioned in the documentation, but 
`itertools.tee` doesn't de-reference items until the tee-iterator itself is 
deleted:

https://pastebin.com/r3JUkH41

Is this a bug or am I missing something?

--
components: Library (Lib)
messages: 364849
nosy: pwuertz
priority: normal
severity: normal
status: open
title: itertools.tee does not release resources during iteration?
type: resource usage
versions: Python 3.7

___
Python tracker 
<https://bugs.python.org/issue40047>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16239] PEP8 arithmetic operator examples

2012-10-26 Thread Peter Würtz

Peter Würtz added the comment:

 x * 2 - 1 is less clear than x*2 - 1
 I don't feel this.  Anyone else feel this? 

I strongly feel so. And if you don't take my word for it, just open any math 
book or look at any formula and recognize that it is the general consensus that 
the elements of a product are written close together whereas the spacing 
between two summands is considerably larger. Typically, the dots between 
products are omitted to reduce the spacing even further.

Trying to educate people to do otherwise is just weird, isn't it?

 It seems to me, this is a serious change in the Style Guide.

Actually it isn't. Even the current style guide says that there should be an 
increased amount of spacing around operators of low(est) priority. The serious 
change happened when the old rule always use exactly one space around all 
arithmetic operators fell, which certainly was a good call.

I've seen arguments on mailing lists whether to use x ** 2 + 1 instead of x**2 
+ 1 based on that rule. I hardly doubt that anyone prefers x ** 2 + 1 over x**2 
+ 1, so neither should the style guide.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16239
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16239] PEP8 arithmetic operator examples

2012-10-15 Thread Peter Würtz

New submission from Peter Würtz:

I think the PEP8 examples for arithmetic expressions are a bit misleading. 
(http://www.python.org/dev/peps/pep-0008/#id20)

The text clearly says that it should add spaces around operators of low(est) 
priority, which means that I'm encouraged to visually group an expression of 
high priority. It doesn't say (anymore?) that there should always be spaces 
around all arithmetic operators.

This is however not reflected in the examples. In the examples
x = x*2 - 1 is listed as a negative example, while being perfectly compliant 
with the guide. Shouldn't this be in the Yes or an Optionally example block?

I believe these examples may cause some people to interpret the style guide in 
a very rigid way, eventually leading to PEP8 formatting tools that flatten out 
nicely grouped expressions.

--
assignee: docs@python
components: Documentation
messages: 172965
nosy: docs@python, pwuertz
priority: normal
severity: normal
status: open
title: PEP8 arithmetic operator examples
type: enhancement

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16239
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com