Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #26090
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeder2.ecngs.de!ecngs!feeder.ecngs.de!xlned.com!feeder1.xlned.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <arnodel@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.092 |
| X-Spam-Evidence | '*H*': 0.82; '*S*': 0.00; 'parsing': 0.07; 'skip:r 60': 0.09; 'cc:addr:python-list': 0.10; 'identifiers': 0.16; 'identifiers.': 0.16; 'readable': 0.16; 'wrote:': 0.17; '>>>': 0.18; 'received:209.85.214.174': 0.21; 'names.': 0.22; 'recognize': 0.22; "skip:' 40": 0.22; 'cc:2**0': 0.23; 'seems': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'message-id:@mail.gmail.com': 0.27; 'good.': 0.32; 'could': 0.32; 'print': 0.32; 'skip:l 40': 0.33; 'skip:b 20': 0.34; 'received:google.com': 0.34; 'received:209.85': 0.35; 'something': 0.35; 'but': 0.36; 'skip:g 30': 0.36; 'should': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'things': 0.38; 'received:209.85.214': 0.39; 'header:Received:5': 0.40; 'your': 0.60; 'july': 0.60; "you've": 0.61; 'time,': 0.62; 'limit': 0.65; 'increase': 0.72; 'miss': 0.75; 'nagy': 0.84; 'crucial': 0.91; 'imagine': 0.96; 'exceeded': 0.97 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=8S9OArBU7MviarUmOVlgJQoJvfOngqQuJMD74GJ+lh0=; b=PKhVlcLoGGlINJa5soRAPVh4xX75kyjfrMb7jEDxpydRBcvMjV0JnwAMvhmhCA8EcP KM1EzxX2F8TtjU/oLWZVXGTE2IJlKAf+mBMlTQmpT4PI6CnAq67pkWtwhus19T1t4dgy f9Sfo3n3/Jz25I+IO1iz5PpeH7pACAtIRafYHtUu0DjKL1UCWT/gKbh+vbBrLX2ZMVXq 76uDzTL498nuDRaHqMl4WVX9p4UY3OVdMO1a09UPMlSg3A7KQpOMKC+q8w7RSCvR37WG UGTLhdwXhYokTaU20WZfftw5rvRdf+XQHbWUkaA8XmIMO1dbqgfVUlqt/flzytFnlGkc knDg== |
| MIME-Version | 1.0 |
| In-Reply-To | <50113768.6070008@shopzeus.com> |
| References | <50113768.6070008@shopzeus.com> |
| Date | Thu, 26 Jul 2012 15:21:32 +0100 |
| Subject | Re: Generating valid identifiers |
| From | Arnaud Delobelle <arnodel@gmail.com> |
| To | Laszlo Nagy <gandalf@shopzeus.com> |
| Content-Type | text/plain; charset=UTF-8 |
| Cc | python-list@python.org |
| 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.2609.1343312496.4697.python-list@python.org> (permalink) |
| Lines | 32 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1343312496 news.xs4all.nl 6902 [2001:888:2000:d::a6]:52747 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:26090 |
Show key headers only | View raw
On 26 July 2012 13:26, Laszlo Nagy <gandalf@shopzeus.com> wrote:
[...]
> I do not want this program to generate very long identifiers. It would
> increase SQL parsing time, and don't look good. Let's just say that the
> limit should be 32 characters. But I also want to recognize the identifiers
> when I look at their modified/truncated names.
[...]
> print repr(Connection.makename("group1_group2_group3_some_field_name"))
> 'group1_group2_group3_some_fiel$AyQVQUXoyf'
>>> len('group1_group2_group3_some_fiel$AyQVQUXoyf')
41
You've exceeded 32 characters! Perhaps you could change:
return basename[:30]+"$"+tail
to:
return basename[:21]+"$"+tail
But then you'd get something like this for your long identifier:
group1_group2_group3_$AyQVQUXoyf
which seems to miss out on a crucial bit: namely the field name.
Also it's hard to imagine a way to keep things readable when we don't
know what the original identifiers look like :)
--
Arnaud
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Generating valid identifiers Arnaud Delobelle <arnodel@gmail.com> - 2012-07-26 15:21 +0100
csiph-web