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


Groups > comp.lang.python > #26105

Re: Generating valid identifiers

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed5.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.004
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'parsing': 0.07; 'derived': 0.09; 'lengths': 0.09; 'matched': 0.09; 'postgresql.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'index': 0.13; 'dom,': 0.16; 'identifiers': 0.16; 'identifiers.': 0.16; 'message- id:@dough.gmane.org': 0.16; 'received:173.11': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'recognizable': 0.16; 'routinely': 0.16; 'element': 0.17; 'creates': 0.18; 'app': 0.19; 'translate': 0.20; 'names.': 0.22; 'recognize': 0.22; 'header:In-Reply-To:1': 0.25; 'header:User- Agent:1': 0.26; 'common': 0.26; 'header:X-Complaints-To:1': 0.28; 'environment': 0.29; 'description,': 0.29; 'table,': 0.29; 'character': 0.29; 'objects': 0.29; 'selection': 0.29; 'words': 0.29; 'source': 0.29; 'field,': 0.30; 'generally': 0.32; 'good.': 0.32; 'legacy': 0.33; 'utility': 0.33; 'problem': 0.33; 'to:addr :python-list': 0.33; 'screen': 0.34; 'similar': 0.35; 'there': 0.35; 'received:org': 0.36; 'created': 0.36; 'but': 0.36; 'characters': 0.36; 'should': 0.36; 'being': 0.37; 'subject:: ': 0.38; 'green': 0.38; 'object': 0.38; 'description': 0.39; 'to:addr:python.org': 0.39; 'where': 0.40; 'header:Received:5': 0.40; 'customer': 0.61; 'time,': 0.62; 'situation': 0.62; 'close': 0.63; 'limit': 0.65; 'marketing': 0.69; 'increase': 0.72; 'reviewed': 0.74; 'cycled': 0.84; 'fitting': 0.84; 'nagy': 0.84; 'resulted': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Emile van Sebille <emile@fenx.com>
Subject Re: Generating valid identifiers
Date Thu, 26 Jul 2012 11:10:19 -0700
References <50113768.6070008@shopzeus.com>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host 173-11-108-137-sfba.hfc.comcastbusiness.net
User-Agent Mozilla/5.0 (Windows NT 5.1; rv:13.0) Gecko/20120614 Thunderbird/13.0.1
In-Reply-To <50113768.6070008@shopzeus.com>
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.2620.1343326094.4697.python-list@python.org> (permalink)
Lines 30
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1343326094 news.xs4all.nl 6936 [2001:888:2000:d::a6]:56786
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:26105

Show key headers only | View raw


On 7/26/2012 5:26 AM Laszlo Nagy said...
> I have a program that creates various database objects in PostgreSQL.
> There is a DOM, and for each element in the DOM, a database object is
> created (schema, table, field, index and tablespace).
>
> 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.

I had a similar problem with one customer where their legacy green 
screen app allowed only 40 characters max for the product description, 
but the marketing description lengths routinely ran out to 75 or so 
characters.  In that situation I reviewed the source marketing 
descriptions and prepped a utility to translate common longer words or 
phrases to one of a selection of shortened abbreviations. I then cycled 
through best fitting substitutions to get as close as reasonable to the 
40 character limit which generally resulted in recognizable descriptions 
in the legacy environment that matched by being directly derived from 
the longer marketing names.

YMMV,

Emile





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


Thread

Re: Generating valid identifiers Emile van Sebille <emile@fenx.com> - 2012-07-26 11:10 -0700

csiph-web