On Wed, Jun 25, 2008 at 4:33 AM, Jim Tittsler <[EMAIL PROTECTED]> wrote:
> On Jun 25, 2008, at 12:18, [EMAIL PROTECTED] wrote:
>
> I write a lot of my "shell scripts" in Python, so I recognize the
> style... but I can't help a couple of comments.
Jim - comments welcome, mine is probably "Python as a Second
Language" (PaSL). More pythonic approaches are welcome, as long as
they aren't too exception heavy, or resource hoggy. :-)
>> + os.system('touch ' + recentclientsdir + '/' + clientid)
>
> I would write that:
> open(os.path.join(recentclientsdir, clientid), 'wb').write('')
> although if you really want it to be able to fail silently, it would
> need to be wrapped in a try: except IOError: pass.
I'll give that a go...
>> + clientcount = os.system('find ' + recentclientsdir +
>> + ' -mmin -5 -type f | wc -l');
>
> And your use of 'find' here and a bit further on is really succinct,
And cheap on resources - I don't ever want to have the list in memory :-)
The pure-python way looks expensive (as the pure Perl way that
File::Find implements). Can you give me an example using subprocess?
> Jim Tittsler, Gisborne
I'm sure we met before - do you ever visit Wellington? :-)
cheers,
martin
--
[EMAIL PROTECTED]
[EMAIL PROTECTED] -- School Server Architect
- ask interesting questions
- don't get distracted with shiny stuff - working code first
- http://wiki.laptop.org/go/User:Martinlanghoff
_______________________________________________
Server-devel mailing list
[email protected]
http://lists.laptop.org/listinfo/server-devel