Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #16535

Re: Clever hack or code abomination?

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 <rosuav@gmail.com>
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 <roy-A03C06.22152730112011@news.panix.com> <jb8qmd$56l$1@dont-email.me> <4ed818bb$0$29988$c3e8da3$5496439d@news.astraweb.com> <mailman.3211.1322791680.27778.python-list@python.org> <4ed86358$0$29988$c3e8da3$5496439d@news.astraweb.com> <mailman.3219.1322805724.27778.python-list@python.org> <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 <rosuav@gmail.com>
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 <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3220.1322817418.27778.python-list@python.org> (permalink)
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

Show key headers only | View raw


On Fri, Dec 2, 2011 at 7:54 PM, Steven D'Aprano
<steve+comp.lang.python@pearwood.info> wrote:
> Dude, it was deliberately obfuscated code. I even named the function
> "obfuscated_prefixes". I thought that would have been a hint <wink>
>
> 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 <grins like a mad thing>

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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Clever hack or code abomination? Roy Smith <roy@panix.com> - 2011-11-30 22:15 -0500
  Re: Clever hack or code abomination? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-12-01 03:38 +0000
  Re: Clever hack or code abomination? Matt Joiner <anacrolix@gmail.com> - 2011-12-01 14:49 +1100
  Re: Clever hack or code abomination? Chris Angelico <rosuav@gmail.com> - 2011-12-01 19:21 +1100
    Re: Clever hack or code abomination? John Ladasky <ladasky@my-deja.com> - 2011-12-06 11:19 -0800
  Re: Clever hack or code abomination? Arnaud Delobelle <arnodel@gmail.com> - 2011-12-01 08:35 +0000
  Re: Clever hack or code abomination? Vito 'ZeD' De Tullio <zak.mc.kraken@libero.it> - 2011-12-01 21:35 +0100
  Re: Clever hack or code abomination? "Martin P. Hellwig" <martin.hellwig@gmail.com> - 2011-12-01 21:13 +0000
    Re: Clever hack or code abomination? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-12-02 00:15 +0000
      Re: Clever hack or code abomination? Chris Angelico <rosuav@gmail.com> - 2011-12-02 13:07 +1100
        Re: Clever hack or code abomination? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-12-02 05:34 +0000
          Re: Clever hack or code abomination? Chris Angelico <rosuav@gmail.com> - 2011-12-02 17:02 +1100
            Re: Clever hack or code abomination? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-12-02 08:54 +0000
              Re: Clever hack or code abomination? Chris Angelico <rosuav@gmail.com> - 2011-12-02 20:16 +1100
  Re: Clever hack or code abomination? Terry Reedy <tjreedy@udel.edu> - 2011-12-01 21:49 -0500
  Re: Clever hack or code abomination? Matt Joiner <anacrolix@gmail.com> - 2011-12-02 16:11 +1100
  Re: Clever hack or code abomination? Chris Hulan <chris.hulan@gmail.com> - 2011-12-02 09:20 -0800

csiph-web