Python_2  1.0
Public Member Functions | Public Attributes | List of all members
_01b_Agenda.Agenda Class Reference

Class for holding an address book. More...

Public Member Functions

def __init__ (self)
 Constructor. More...
 
def putPhone (self, nome, lista)
 Associates new phones to the given name. More...
 
def getPhone (self, nome, index)
 Retrieves the index-th phone of a given contact. More...
 
def __eq__ (self, other)
 Compares two agendas. More...
 
def remContact (self, nome)
 Removes a given contact from the address book. More...
 
def __repr__ (self)
 Used to print a human readable presentation of an object. More...
 
def __str__ (self)
 For printing an address book x by using just print x. More...
 

Public Attributes

 dic
 Dictionary for associating a contact name to a telephone list. More...
 

Detailed Description

Class for holding an address book.

Constructor & Destructor Documentation

◆ __init__()

def _01b_Agenda.Agenda.__init__ (   self)

Constructor.

Just creates an empty dictionary.

Member Function Documentation

◆ __eq__()

def _01b_Agenda.Agenda.__eq__ (   self,
  other 
)

Compares two agendas.

References _01b_Agenda.Agenda.dic.

◆ __repr__()

def _01b_Agenda.Agenda.__repr__ (   self)

Used to print a human readable presentation of an object.

In this case, it prints the contact name and his phone numbers.

Returns
a multi line string.

References _01b_Agenda.Agenda.dic.

◆ __str__()

def _01b_Agenda.Agenda.__str__ (   self)

For printing an address book x by using just print x.

Each line is made up of a name followed by its corresponding phones. Names are listed in alphabetical order.

Returns
a multi line string.

References _01b_Agenda.Agenda.dic.

◆ getPhone()

def _01b_Agenda.Agenda.getPhone (   self,
  nome,
  index 
)

Retrieves the index-th phone of a given contact.

Parameters
nomecontact name.
indexselects a certain phone from the contact phone list.
Returns
a phone number or None, if the contact does not exist.

References _01b_Agenda.Agenda.dic.

◆ putPhone()

def _01b_Agenda.Agenda.putPhone (   self,
  nome,
  lista 
)

Associates new phones to the given name.

Parameters
nomecontact name.
listacontact phone list.

References _01b_Agenda.Agenda.dic.

◆ remContact()

def _01b_Agenda.Agenda.remContact (   self,
  nome 
)

Removes a given contact from the address book.

Parameters
nomecontact name.

References _01b_Agenda.Agenda.dic.

Member Data Documentation

◆ dic

_01b_Agenda.Agenda.dic

The documentation for this class was generated from the following file: