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

From Lele Gaifax <lele@metapensiero.it>
Subject Re: Coding challenge: Optimise a custom string encoding
Date 2014-08-19 12:00 +0200
Organization Nautilus Entertainments
References <6e869040-98e9-437b-b024-4ffe7abc3054@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.13140.1408442459.18130.python-list@python.org> (permalink)

Show all headers | 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