Clever hack or code abomination?

Chris Angelico rosuav at gmail.com
Fri Dec 2 04:16:55 EST 2011


On Fri, Dec 2, 2011 at 7:54 PM, Steven D'Aprano
<steve+comp.lang.python at 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



More information about the Python-list mailing list