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


Groups > comp.lang.python > #35439 > unrolled thread

Re: Parsing files in python

Started byDennis Lee Bieber <wlfraed@ix.netcom.com>
First post2012-12-24 00:16 -0500
Last post2012-12-24 00:16 -0500
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#35439 — Re: Parsing files in python

FromDennis Lee Bieber <wlfraed@ix.netcom.com>
Date2012-12-24 00:16 -0500
SubjectRe: Parsing files in python
Message-ID<mailman.1238.1356326208.29569.python-list@python.org>
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/

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web