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


Groups > comp.lang.python > #35439

Re: Parsing files in python

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!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; 'output': 0.04; 'say,': 0.05; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:files': 0.09; 'tuple': 0.09; 'def': 0.10; 'subject:python': 0.11; 'exercise': 0.13; 'student': 0.15; 'dec': 0.15; '2",': 0.16; 'angle': 0.16; 'brackets.': 0.16; 'left,': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'recognizing': 0.16; 'mon,': 0.16; '>>>': 0.18; 'define': 0.20; 'tuples': 0.22; 'raw': 0.27; 'header:X-Complaints-To:1': 0.28; 'chris': 0.28; 'end,': 0.29; 'smart': 0.29; 'vector': 0.29; 'skip:_ 10': 0.29; 'class': 0.29; 'print': 0.32; 'url:home': 0.33; 'handle': 0.33; 'to:addr:python-list': 0.33; 'operations': 0.33; 'received:org': 0.36; 'but': 0.36; 'charset:us-ascii': 0.36; 'subject:: ': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'skip:" 10': 0.40; 'header:Received:5': 0.40; 'easy': 0.60; 'export': 0.62; 'dennis': 0.91; 'received:108': 0.91
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Dennis Lee Bieber <wlfraed@ix.netcom.com>
Subject Re: Parsing files in python
Date Mon, 24 Dec 2012 00:16:37 -0500
Organization > Bestiaria Support Staff <
References <20121223171955.GB32535@ifeobi.illom.net> <kb8c6k$kb7$1@ger.gmane.org> <CAPTjJmpUs46to1OdcGc_j76H=KrNHnzyS=-9i6B_2FNJGDywaw@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host adsl-108-68-179-0.dsl.klmzmi.sbcglobal.net
X-Newsreader Forte Agent 3.3/32.846
X-No-Archive YES
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 <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.1238.1356326208.29569.python-list@python.org> (permalink)
Lines 30
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1356326208 news.xs4all.nl 6942 [2001:888:2000:d::a6]:52939
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:35439

Show key headers only | View raw


On Mon, 24 Dec 2012 15:05:48 +1100, Chris Angelico <rosuav@gmail.com>
declaimed the following in gmane.comp.python.general:


> 
> It would also require some smart footwork at the export end,
> recognizing that a tuple needs to be output with angle brackets.
> 
	That's the easy part... If you don't use raw tuples but define a
class for POV vectors...

>>> class Vector(object):
... 	def __init__(self, tpl):
... 		self.vct = tpl
... 	def __str__(self):
... 		itms = ", ".join([str(x) for x in self.vct])
... 		return "< " + itms + " >"
... 	
>>> x = Vector((1, 2, 3))
>>> print x
< 1, 2, 3 >
>>> 

{Extending that to handle a non-tuple initialization -- Vector(1, 2, 3)
-- and operations that return Vector objects... say "y = x * 2", is
left, as they say, as an exercise for the student <G>}
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
        wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

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


Thread

Re: Parsing files in python Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-12-24 00:16 -0500

csiph-web