How coding in Python is bad for you

Steven D'Aprano steve+comp.lang.python at pearwood.info
Mon Jan 23 23:27:02 EST 2017


On Tuesday 24 January 2017 13:41, Chris Angelico wrote:

> On Tue, Jan 24, 2017 at 12:55 PM, Steve D'Aprano
> <steve+python at pearwood.info> wrote:
>> Reading his post, I get the impression he's the sort of programmer who
>> believes in never, ever, ever, ever re-using a variable, so he might do
>> something like:
>>
>> raw_data = collect_raw_data()  # generates 10GB of data
>> data_after_step_one = massage(raw_data)
>> data_after_step_two = process(data_after_step_one)
>> ...
>> sorted_data = sorted(data_after_step_ten)
>>
>> and then wonders why he's running out of memory. "That's a memory leak!"
> 
> How is that any different in any other language? I don't understand
> how even this is a criticism of Python. If you were working in Java,
> say, you'd have basically the same result - keep all the stuff, keep
> all the memory usage.

Keep in mind that I'm only *guessing* from the impression that the author 
gives. I don't *know* that is what he's doing.

He makes all these claims about Python, but doesn't show his code, so the best 
we can do is try to predict what could plausibly explain the observation.



-- 
Steven
"Ever since I learned about confirmation bias, I've been seeing 
it everywhere." - Jon Ronson




More information about the Python-list mailing list