Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'python,': 0.01; 'ascii': 0.07; 'function,': 0.07; 'subject:code': 0.07; 'deliberately': 0.09; 'shame': 0.09; 'read.': 0.10; 'received:209.85.210.174': 0.13; 'received:mail-iy0-f174.google.com': 0.13; 'chr': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'hint': 0.16; 'obfuscated,': 0.16; 'obvious.': 0.16; 'ord': 0.16; 'sins': 0.16; 'wrote:': 0.18; 'dec': 0.22; 'header:In-Reply-To:1': 0.22; 'code.': 0.26; "i'm": 0.26; 'function': 0.27; 'message- id:@mail.gmail.com': 0.28; 'pm,': 0.29; 'agreed.': 0.30; 'criticism': 0.30; 'kinda': 0.30; 'mentioning': 0.30; 'subject:?': 0.31; "didn't": 0.31; 'named': 0.33; 'fri,': 0.34; 'to:addr :python-list': 0.34; 'calling': 0.34; 'changing': 0.35; 'skip:" 20': 0.35; 'received:google.com': 0.37; 'steven': 0.38; 'received:209.85': 0.38; 'characters': 0.39; 'flexibility': 0.39; 'why': 0.39; "it's": 0.40; 'received:209': 0.40; 'to:addr:python.org': 0.40; '2011': 0.61; 'worth': 0.61; 'committed': 0.64; 'proud': 0.70; 'anything.': 0.71; 'impressed': 0.73; 'lose': 0.84; 'readability': 0.84; 'scary': 0.84; 'subject:hack': 0.91; 'besides,': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=DtwKNMhYCPiYrK/O3+6LO4gBXd1fnzGyfpEONJmliz8=; b=TdRPDnEsvEC5/P0xuND0IUzcTLoEKTqsXF/iMu/IzlTU1VEsHK6rV+tkkGsq7AUHxa +plbam/g+tLvDy/BvYGO7jaCF3vHppVvLzSklBgISO8RXjWtoVGaoGQuYXO5gK5n4n2p 6rZn40bld4ExDWbITtmWW4q37NVWN80QK503w= MIME-Version: 1.0 In-Reply-To: <4ed8923f$0$29988$c3e8da3$5496439d@news.astraweb.com> References: <4ed818bb$0$29988$c3e8da3$5496439d@news.astraweb.com> <4ed86358$0$29988$c3e8da3$5496439d@news.astraweb.com> <4ed8923f$0$29988$c3e8da3$5496439d@news.astraweb.com> Date: Fri, 2 Dec 2011 20:16:55 +1100 Subject: Re: Clever hack or code abomination? From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 21 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1322817418 news.xs4all.nl 6948 [2001:888:2000:d::a6]:38246 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:16535 On Fri, Dec 2, 2011 at 7:54 PM, Steven D'Aprano wrote: > Dude, it was deliberately obfuscated code. I even named the function > "obfuscated_prefixes". I thought that would have been a hint > > It's kinda scary that of all the sins against readability committed in my > function, including isinstance(type(c), type(type)) which I was > particularly proud of, the only criticism you came up with was that > chr(45) is hard to read. I'm impressed Heh! I know it was obfuscated, and that's why I didn't bother mentioning the obvious. > And besides, given how rare such byte-manipulations on ASCII characters > are in Python, it would be a shame to lose the ability to use '' and "" > for strings just to avoid calling ord and chr functions. Agreed. That flexibility is a _huge_ advantage. Definitely not worth changing anything. ChrisA