Daniel Browne wrote:
> [posted to rush.general]
>
> That's cool Greg; sure, I'll give it a whirl. I couldn't see a way to do it=
> myself since the submit script version I have seems dependent upon using t=
> he -last file to pass parameters to display the gui.
It actually merges well into the code that handles the -last file.
It's the same function that handles the command line presets (eg. -fields).
> Python is great, though I dislike the lack of delimiter braces..
Yes, I do miss the ability to control scoping of variables within
procedures via braces.
I would think python could do this with its indenting, but it doesn't
work that way.
There are hacky ways to do this, but I don't like them. For now we
just live with the inability to control scoping until "python 3000" ;)
> and the regex operator from Perl.
Actually the perl regex stuff is in python.
Use "import re", eg:
try:
(h,m,s) = re.search("(\d+):(\d+):(\d+)",hms).groups()
# match worked
except:
# match failed..
..where the perl equivalent might be:
if ( hms =~ /(\d+):(\d+):(\d+)/ ) {
# match worked
my ($h,$m,$s) = ($1,$2,$3);
} else {
# match failed
}
regex's are a good way to parse strings; I use em quite a lot
throughout.
You can also do search/replace using re.sub() and friends.
See help(re), which self-describes as regexs 'similar to perl'.
Seems like the one thing everyone can agree on are the additions
perl brought to regex are a Good Thing. Perl regex has been imported
to other languages, so it's almost always available somehow.
--
Greg Ercolano, erco@(email surpressed)
Seriss Corporation
Rush Render Queue, http://seriss.com/rush/
Tel: (Tel# suppressed)ext.23
Fax: (Tel# suppressed)
Cel: (Tel# suppressed)
|