Browse Source

new internal method _set_id() to set global last_id attribute to the highest id found in actual notebook object

master
T. Meissner 10 years ago
parent
commit
71f2e48751
1 changed files with 8 additions and 0 deletions
  1. +8
    -0
      python_3_oop/chapter02/notebook.py

+ 8
- 0
python_3_oop/chapter02/notebook.py View File

@ -67,3 +67,11 @@ class Notebook:
return note return note
return None return None
def _set_id(self):
id = 1
for note in self.notes:
if note.id > id:
id = note.id
global last_id
last_id = id

Loading…
Cancel
Save