[time-nuts] "PYLT" Python LabTools

Poul-Henning Kamp phk at phk.freebsd.dk
Sun Jan 16 22:25:31 UTC 2011


In message <20110116221429.AF8D580003B at ip-64-139-1-69.sjc.megapath.net>, Hal Mu
rray writes:

>How about a config file?

Yeah, that bit is obvious, the trouble is all the "something like" :-)

I'm a firm beliver in Gettys principles for software development,
number 3 of which says:

	3.The only thing worse than generalizing from one example
	  is generalizing from no examples at all.

But rather than write a lot of code to deal with config file reading,
we should simply use python:

Create a pylt_site.py containing something like:

	import hp34401a
	import hp33120a

	def hp34401a():
		return hp34401a.hp34401a(name="/dev/ttyfoo", adr=11)

	def hp33120a():
		return hp33120a.hp33120a(name="/dev/ttybar", adr=5)

and then use that in your programs:

	include pylt_site

	g=pylt_site.hp33120a()
	m=pylt_site.hp34401a()

	# do stuff.

Problem solved ?

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.



More information about the time-nuts mailing list