Re: Bad Code Snippet of the Day

2014-02-18 Thread Roy Smith
In article , Terry Reedy wrote: > On 2/18/2014 11:47 AM, Chris Angelico wrote: > > I call this "Russian Exception Roulette". It came about because of > > some discussions on python-ideas regarding the new PEP 463 and > > exception handling. > > > > try: > > exc = getattr(__builtins__,random

Re: Bad Code Snippet of the Day

2014-02-18 Thread Chris Angelico
On Wed, Feb 19, 2014 at 8:10 AM, Rick Johnson wrote: > Beyond that this code (either conscientiously or unconsciously) > exposes the onerous and obfuscation of a language design > that coddles a global function nightmare paradigm over the > elegance of true OOP -- talk about cutting off your nose

Re: Bad Code Snippet of the Day

2014-02-18 Thread Rick Johnson
On Tuesday, February 18, 2014 10:47:15 AM UTC-6, Chris Angelico wrote: > I call this "Russian Exception Roulette". It came about because of > some discussions on python-ideas regarding the new PEP 463 and > exception handling. > try: > > exc = getattr(__builtins__,random.choice(list(filter(lam

Re: Bad Code Snippet of the Day

2014-02-18 Thread Chris Angelico
On Wed, Feb 19, 2014 at 7:41 AM, Terry Reedy wrote: > On 2/18/2014 11:47 AM, Chris Angelico wrote: >> >> I call this "Russian Exception Roulette". It came about because of >> some discussions on python-ideas regarding the new PEP 463 and >> exception handling. >> >> try: >> exc = getattr(__bu

Re: Bad Code Snippet of the Day

2014-02-18 Thread Terry Reedy
On 2/18/2014 11:47 AM, Chris Angelico wrote: I call this "Russian Exception Roulette". It came about because of some discussions on python-ideas regarding the new PEP 463 and exception handling. try: exc = getattr(__builtins__,random.choice(list(filter(lambda x: x.endswith("Error"),dir(__bu

Bad Code Snippet of the Day

2014-02-18 Thread Chris Angelico
I call this "Russian Exception Roulette". It came about because of some discussions on python-ideas regarding the new PEP 463 and exception handling. try: exc = getattr(__builtins__,random.choice(list(filter(lambda x: x.endswith("Error"),dir(__builtins__) f() except exc: print("You