-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Cameron,

Many thanks for your helpful comments. I do still have some problems
with my script, but it's probably better to start a new thread with an
appropriate subject.

I'm a bit new to Python, so it still seems like magic sometimes
(someone else said the same in a different thread). A lot of my coding
is 'trial & error', and I'll admit that at the moment my main goal is
getting things to work; after that I can explore making my code more
efficient/readable etc. But I appreciate your suggestions.

On 26/02/14 05:31, Cameron Simpson wrote:
> Hi Bob,
> 
[...]
> 
> The other things are just script remarks, not directly related to
> your problem:
> 
> On 24Feb2014 16:07, Bob Williams <li...@barrowhillfarm.org.uk>
> wrote:
>> if pathList[j][-3:] == "mp3":
> 
> This is often written (I've inserted a dot, assuming you don't
> want "foomp3", only "foo.mp3"):
> 
> if pathList[j].endswith(".mp3"):
> 
> More readable, and also more reliable because it doesn't rely on 
> you getting the "3" correct.
> 
Yes, and reduces the need for explanatory comments.

>> linkName1 = pathList[j][0:-3] + "mp3"
> 
> Isn't this exactly the same as pathList[j] ?
> 
Actually, no. pathList[j] can contain either .mp3 files or .flac
files. In fact the main function of the script is to run all the flacs
through lame to convert them into mp3s. If they are already mp3s, then
a symlink will suffice.

>> linkName2 = destPath + linkName1[len(sourcePath):]
> 
> You might want to spell this:
> 
> linkName2 = os.path.join(destPath, linkName1[len(sourcePath):])
> 
More good stuff. :-)

Bob
- -- 
Bob Williams
System:  Linux 3.11.10-7-desktop
Distro:  openSUSE 13.1 (x86_64) with KDE Development Platform: 4.12.2
Uptime:  12:00pm up 13 days 20:00, 6 users, load average: 0.10, 0.19, 0.26
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlMOC0UACgkQ0Sr7eZJrmU77fwCeIAgFpOKEdt5C6Q/qzHPQglnm
91gAnRLHLs5u/369RNsBOMOFeZVhTiN5
=w7La
-----END PGP SIGNATURE-----
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to