Python Using Databases in Python Gettin' CRUD-y With It Add An Entry

Talha Rashid
PLUS
Talha Rashid
Courses Plus Student 4,250 Points

Why Kenneth does not write add_entry() in Initialize

Why Kenneth not write add_entry() in Initialize

1 Answer

Jebadeiah Jones
Jebadeiah Jones
10,369 Points

If Kenneth were to write 'add_entry()' into initialize(), it would create a new entry everytime you opened your diary. This would be fine in some uses, but what if you're trying to simply read your diary? You'd end up creating empty diary entries simply by opening it.

Jebadeiah Jones
Jebadeiah Jones
10,369 Points

I'll amend this some since it won't actually save the entry until you choose to. You will be entering into a new entry everytime you open the diary, though. It's possible that, for your use, it makes more sense to initialize it into a new entry, but I think for a general audience the preference would still be to open the diary and then choose where you'd like to go, rather than opening it into a new entry and then having to back out to what you'd like to choose.