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


Groups > comp.lang.python > #76555

Re: Coding challenge: Optimise a custom string encoding

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; '"""': 0.07; 'string': 0.09; 'alias': 0.09; 'ascii': 0.09; 'received:151': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:string': 0.09; 'willmer': 0.09; 'def': 0.12; 'emanuele': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'alex': 0.19; 'header:User-Agent:1': 0.23; 'byte': 0.24; 'unicode': 0.24; 'defined': 0.27; 'header:X-Complaints-To:1': 0.27; 'minor': 0.31; 'writes:': 0.31; 'but': 0.35; "didn't": 0.36; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'access,': 0.60; 'che': 0.60; 'quando': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Lele Gaifax <lele@metapensiero.it>
Subject Re: Coding challenge: Optimise a custom string encoding
Date Tue, 19 Aug 2014 12:00:45 +0200
Organization Nautilus Entertainments
References <6e869040-98e9-437b-b024-4ffe7abc3054@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 8bit
X-Gmane-NNTP-Posting-Host 151.62.28.218
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/24.3.93 (gnu/linux)
Cancel-Lock sha1:XM4jpy0dUoY6cm4xAu4KEMBcjrY=
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.13140.1408442459.18130.python-list@python.org> (permalink)
Lines 18
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1408442459 news.xs4all.nl 2916 [2001:888:2000:d::a6]:39979
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:76555

Show key headers only | View raw


Alex Willmer <alex@moreati.org.uk> writes:

> def plus_encode(s):
>     """Encode a unicode string with only ascii letters, digits, _, -, @, +
>     """
>     bytemap_ = bytemap
>     s_utf8 = s.encode('utf-8')
>     return ''.join([bytemap[byte] for byte in s_utf8])

Minor nit: you defined a local alias for bytemap for faster access, but
didn't actually used it.

ciao, lele.
-- 
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
lele@metapensiero.it  |                 -- Fortunato Depero, 1929.

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


Thread

Coding challenge: Optimise a custom string encoding Alex Willmer <alex@moreati.org.uk> - 2014-08-18 12:16 -0700
  Re: Coding challenge: Optimise a custom string encoding Terry Reedy <tjreedy@udel.edu> - 2014-08-18 16:16 -0400
    Re: Coding challenge: Optimise a custom string encoding Alex Willmer <alex@moreati.org.uk> - 2014-08-18 14:27 -0700
      Re: Coding challenge: Optimise a custom string encoding Peter Otten <__peter__@web.de> - 2014-08-19 01:35 +0200
  Re: Coding challenge: Optimise a custom string encoding Chris Angelico <rosuav@gmail.com> - 2014-08-19 09:28 +1000
  Re: Coding challenge: Optimise a custom string encoding Lele Gaifax <lele@metapensiero.it> - 2014-08-19 12:00 +0200

csiph-web