On 15/02/2014 03:31, Nick Timkovich wrote:
OK, now the trick; adding `data = None` inside the generator works, but
in my actual code I wrap my generator inside of `enumerate()`, which
seems to obviate the "fix". Can I get it to play nice or am I forced to
count manually. Is that a feature?
On
Chris Angelico wrote:
> On Sat, Feb 15, 2014 at 6:27 PM, Ian Kelly wrote:
>> On Fri, Feb 14, 2014 at 8:31 PM, Nick Timkovich
>> wrote:
>>> OK, now the trick; adding `data = None` inside the generator works, but
>>> in my actual code I wrap my generator inside of `enumerate()`, which
>>> seems to
On Fri, 14 Feb 2014 22:21:11 -0500, Roy Smith used a generator:
> print g1.next()
Roy, unless you're stuck with Python 2.5 (or older!), you ought to use
the built-in function next(g1) rather than directly call the next method.
Not only is this the recommended way to do it, but it's also more fu
On Sat, Feb 15, 2014 at 6:27 PM, Ian Kelly wrote:
> On Fri, Feb 14, 2014 at 8:31 PM, Nick Timkovich
> wrote:
>> OK, now the trick; adding `data = None` inside the generator works, but in
>> my actual code I wrap my generator inside of `enumerate()`, which seems to
>> obviate the "fix". Can I ge
On Fri, Feb 14, 2014 at 8:31 PM, Nick Timkovich wrote:
> OK, now the trick; adding `data = None` inside the generator works, but in
> my actual code I wrap my generator inside of `enumerate()`, which seems to
> obviate the "fix". Can I get it to play nice or am I forced to count
> manually. Is th
OK, now the trick; adding `data = None` inside the generator works, but in
my actual code I wrap my generator inside of `enumerate()`, which seems to
obviate the "fix". Can I get it to play nice or am I forced to count
manually. Is that a feature?
On Fri, Feb 14, 2014 at 9:21 PM, Roy Smith wrot
In article ,
Nick Timkovich wrote:
> Ah, I think I was equating `yield` too closely with `return` in my head.
> Whereas `return` results in the destruction of the function's locals,
> `yield` I should have known keeps them around, a la C's `static` functions.
> Many thanks!
It's not quite lik
Ah, I think I was equating `yield` too closely with `return` in my head.
Whereas `return` results in the destruction of the function's locals,
`yield` I should have known keeps them around, a la C's `static` functions.
Many thanks!
--
https://mail.python.org/mailman/listinfo/python-list
On Fri, Feb 14, 2014 at 3:27 PM, Nick Timkovich wrote:
> I have a Python 3.x program that processes several large text files that
> contain sizeable arrays of data that can occasionally brush up against the
> memory limit of my puny workstation. From some basic memory profiling, it
> seems like w
I have a Python 3.x program that processes several large text files that
contain sizeable arrays of data that can occasionally brush up against the
memory limit of my puny workstation. From some basic memory profiling, it
seems like when using the generator, the memory usage of my script balloons
10 matches
Mail list logo