[Tutor] How to get script to detect whether a file exists?

Richard D. Moores rdmoores at gmail.com
Tue Aug 3 02:16:15 CEST 2010


On Mon, Aug 2, 2010 at 16:55, Alan Gauld <alan.gauld at btinternet.com> wrote:
> "Richard D. Moores" <rdmoores at gmail.com> wrote
>
>> By golly, you're right! Your point led to changes in 4 lines, the ones
>> highlighted: <http://tutoree7.pastebin.com/xDUfUAET>
>
> Its a Good Thing(TM) to keep your interface specs consistent so
> I'd change the order of the parameters in repickling() to match
> those in create_pickle_file()

Yes, I discovered that. A good lesson. That was one factor that kept
me from recognizing that create_pickle_file() and repickling() were
essentially identical, and as Hugo pointed out, one could be removed.
I did that. See <http://tutoree7.pastebin.com/VkuWnNJe>

>
> For bonus points create a PickleFile class that has dump(),
> load() and repickle() methods - and uses __init__() for create obviously.
> The class can store the file name for convenience.

Hoo boy, how much time do I have? I've yet to create a class, though
I've studied them a bit. For example in an older version of your
tutorial -- the bank account example.

Dick


More information about the Tutor mailing list