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


Groups > comp.lang.python > #20118

Want to improve my code.

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <hobson42@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.009
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'received:81.103': 0.09; 'received:81.103.221': 0.09; 'received:81.103.221.35': 0.09; 'received:ispmail.ntl.com': 0.09; 'received:ntl.com': 0.09; 'tags,': 0.09; 'code?': 0.16; 'from:addr:hobson42': 0.16; 'from:name:ian': 0.16; 'nodes': 0.16; 'parsed': 0.16; 'received:192.168.0.12': 0.16; 'received:aamtaout04-winn.ispmail.ntl.com': 0.16; 'repetition': 0.16; 'reply-to:addr:hobson42': 0.16; 'written': 0.19; 'tree.': 0.23; 'code': 0.26; 'load': 0.26; 'all,': 0.27; "i'm": 0.28; 'html,': 0.29; 'lines': 0.30; 'tail': 0.30; 'message- id:@gmail.com': 0.31; 'there': 0.33; 'header:User-Agent:1': 0.33; 'about.': 0.34; 'routine': 0.34; 'to:addr:python-list': 0.35; 'moving': 0.35; 'using': 0.37; 'received:192': 0.38; 'data': 0.38; 'url:org': 0.39; 'to:addr:python.org': 0.40; 'improve': 0.62; 'here': 0.64; 'header:Reply-To:1': 0.70; 'reply-to:no real name:2**0': 0.72; 'reply-to:addr:gmail.com': 0.76; 'subject:improve': 0.84; 'troubles': 0.84
Date Thu, 09 Feb 2012 23:09:07 +0000
From Ian <hobson42@gmail.com>
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:9.0) Gecko/20111222 Thunderbird/9.0.1
MIME-Version 1.0
To python-list@python.org
Subject Want to improve my code.
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Cloudmark-Analysis v=1.1 cv=JvdXmxIgLJv2/GthKqHpGJEEHukvLcvELVXUanXFreg= c=1 sm=0 a=SHQDgO6TkQYA:10 a=nDghuxUhq_wA:10 a=hcRjaz30x_AA:10 a=d3ZwFMNkyaEA:10 a=8nJEP1OIZ-IA:10 a=b_zsFdCHAAAA:8 a=VUfQWq45rk4pQCb-3lUA:9 a=4XB1hxDyk3_zB_IIJLUA:7 a=wPNLvfGTeEIA:10 a=GlKwh0OTtA4A:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
Reply-To hobson42@gmail.com
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.5619.1328828964.27778.python-list@python.org> (permalink)
Lines 17
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1328828964 news.xs4all.nl 6843 [2001:888:2000:d::a6]:57963
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:20118

Show key headers only | View raw


Hi all,

I'm using  lxml etree, and have written a routine to remove nodes in the 
parsed tree.

Typically, I load html, and remove <font> tags, so I am moving the font 
tags children up and moving the text and tail data about.  The code of 
the deleteElem routine is here  http://snipt.org/GSoo0

It troubles me that there is so much repetition in the lines that call 
joiner.

How can I improve the code?

Regards

Ian

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


Thread

Want to improve my code. Ian <hobson42@gmail.com> - 2012-02-09 23:09 +0000

csiph-web