>         ext = os.path.splitext(fn)[1][1:]

I find this line a bit ... wider than I prefer.

With these functions that return two things, I will often do...

root, ext = os.path.splitext(fn)
ext = ext[1:]

Two lines instead of one, true, but especially when working with
students it illustrates one of python's cooler features (unpacking).


If I will not be using the root portion, I might do...

_, ext = os.path.splitext(fn)
ext = ext[1:]


I sat and thought about using a different name for the first ext --
maybe dotext or dot_ext, but I don't think it is necessary.

                                          
_______________________________________________
Edu-sig mailing list
Edu-sig@python.org
https://mail.python.org/mailman/listinfo/edu-sig

Reply via email to