Scripting discussion (Was: scripting fun)
Steve Lamb
grey at dmiyu.org
Fri Jun 6 19:44:20 UTC 2008
On Fri, June 6, 2008 12:05 pm, Smoot Carl-Mitchell wrote:
> Yep. But remember, us old Unix hackers from 20 years ago did not have
> all those nifty languages at our disposal. :-)
Too true. On the other, other hand I did say I went back 10 years and
most of that's covered in Perl and Python now. ^.^
> I am always careful to follow the parameter passing conventions
> and the I/O conventions, so I can put the new command in a shell
> pipeline, if I need to.
That I can get behind. Shell as the most basic of glue.
Though recently my Python has morphed into "Everything is a library".
Almost every script ends with this block:
if __name__ == '__main__':
main()
else:
print 'Foo v%s loaded.' % version
Run it standalone it does the right thing. I need its functionality in
another Python script I need only import this one and then call
foo.main(). For those, like me, who program organically this gets to be
very natural and very fast after a while.
> Another thing I do religiously id put all the
> code I write under some kind of source code control system, so when I
> make changes I can back them out if I need to. It also allows me to see
> how a program evolves over time.
Mercurial, mercurial, mercurial. Finally got myself and one other
person at work to use hg religiously and it's saved out bacon a few
times now. Not to mention its fun watching the branching we do when
we're both developing in our own repositories before pushing back to the
main repo.
--
Steve Lamb
More information about the ubuntu-users
mailing list