Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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

Talha Rashid
Talha Rashid
Courses Plus Student 4,645 Points

Why Kenneth does not write add_entry() in Initialize

Why Kenneth not write add_entry() in Initialize

1 Answer

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.

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.