Gabriel Genellina wrote:
> At Wednesday 18/10/2006 22:51, Cameron Walsh wrote:
>>> previous_directory = os.getcwd()
>> try:
>> os.chdir(directory)
>> [ ... ]
>> return modules
>> finally:
>> os.chdir(previous_directory)
>>>> Woah, that actually works? Having the "finally" after the "return"?
>> That could make some things easier, and some things harder...
>> Note that moving the return statement after the finally does *exactly*
> the same thing, generates shorter code, and is a lot more readable (IMHO).
>>
I wholeheartedly agree, the above version is hideous. It was a
copy-paste error that got it after the return statement and I was
surprised to see it actually worked.