Re: Awful code of the week

2016-08-09 Thread Steven D'Aprano
On Tuesday 09 August 2016 15:37, Chris Angelico wrote: [...] >> You can't be too careful with memory management. > > Right. Of course, it gets very onerous, so we tend to use a context > manager instead. > > def process(self, stuff): > with deallocate() as cleanup: > clea

Re: Awful code of the week

2016-08-08 Thread Chris Angelico
On Tue, Aug 9, 2016 at 3:20 PM, Steven D'Aprano wrote: >> def process(self, stuff): >> files = self.files >> files = [] # to save memory >> files = self.files >> for file in files: >> file.process(stuff) >> return 1 > > def process(self,

Re: Awful code of the week

2016-08-08 Thread Steven D'Aprano
On Tuesday 09 August 2016 13:59, Chris Angelico wrote: > On Tue, Aug 9, 2016 at 1:46 PM, Rick Johnson > wrote: >> On Sunday, August 7, 2016 at 1:54:51 AM UTC-5, Steven D'Aprano wrote: >>> Seen in the office IRC channel: >>> >>> >>> (13:23:07) fred: near_limit = [] >>> (13:23:07) fred: nea

Re: Awful code of the week

2016-08-08 Thread Chris Angelico
On Tue, Aug 9, 2016 at 1:46 PM, Rick Johnson wrote: > On Sunday, August 7, 2016 at 1:54:51 AM UTC-5, Steven D'Aprano wrote: >> Seen in the office IRC channel: >> >> >> (13:23:07) fred: near_limit = [] >> (13:23:07) fred: near_limit.append(1) >> (13:23:07) fred: near_limit = len(near_li

Re: Awful code of the week

2016-08-08 Thread Rick Johnson
On Sunday, August 7, 2016 at 1:54:51 AM UTC-5, Steven D'Aprano wrote: > Seen in the office IRC channel: > > > (13:23:07) fred: near_limit = [] > (13:23:07) fred: near_limit.append(1) > (13:23:07) fred: near_limit = len(near_limit) > (13:23:09) fred: WTF Sure, this code smells of naus

Re: Awful code of the week

2016-08-07 Thread Steven D'Aprano
On Mon, 8 Aug 2016 08:03 am, Tim Delaney wrote: > On 7 August 2016 at 16:54, Steven D'Aprano < > steve+comp.lang.pyt...@pearwood.info> wrote: > >> Seen in the office IRC channel: >> >> >> (13:23:07) fred: near_limit = [] >> (13:23:07) fred: near_limit.append(1) >> (13:23:07) fred: nea

Re: Awful code of the week

2016-08-07 Thread Tim Delaney
On 7 August 2016 at 16:54, Steven D'Aprano < steve+comp.lang.pyt...@pearwood.info> wrote: > Seen in the office IRC channel: > > > (13:23:07) fred: near_limit = [] > (13:23:07) fred: near_limit.append(1) > (13:23:07) fred: near_limit = len(near_limit) > (13:23:09) fred: WTF > Assuming

Re: Awful code of the week

2016-08-07 Thread Chris Angelico
On Sun, Aug 7, 2016 at 4:54 PM, Steven D'Aprano wrote: > Seen in the office IRC channel: > > > (13:23:07) fred: near_limit = [] > (13:23:07) fred: near_limit.append(1) > (13:23:07) fred: near_limit = len(near_limit) > (13:23:09) fred: WTF > > > > Speaks for itself. The Real WTF is tha

Awful code of the week

2016-08-06 Thread Steven D'Aprano
Seen in the office IRC channel: (13:23:07) fred: near_limit = [] (13:23:07) fred: near_limit.append(1) (13:23:07) fred: near_limit = len(near_limit) (13:23:09) fred: WTF Speaks for itself. -- Steve -- https://mail.python.org/mailman/listinfo/python-list