Package butler :: Module user :: Class User
[hide private]
[frames] | no frames]

Class User

object --+
         |
        User

The class User represents users of the Butler wine diary program. Each user has a number of wines that they have tasted and rated.

Instance Methods [hide private]
 
__init__(self)
Creates a new user who has tasted no wines yet.
 
add_wine(self, new_wine)
Adds a new wine to the user's list of tasted wines.
 
get_favorite(self)
Returns the wine that the user rated the highest, i.e., the wine which has the highest rating of the ones added with method add_wine.
 
get_tasted_wines(self)
Returns a list of all the wines the user has tasted.

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

 

Creates a new user who has tasted no wines yet.

Overrides: object.__init__

add_wine(self, new_wine)

 

Adds a new wine to the user's list of tasted wines.

Parameters:
  • new_wine (wine object) - the new wine diary item to add

get_favorite(self)

 

Returns the wine that the user rated the highest, i.e., the wine which has the highest rating of the ones added with method add_wine. If there is a tie for first place, the wine tasted first is returned.

Returns:
the user's favorite wine (type: wine object)

get_tasted_wines(self)

 

Returns a list of all the wines the user has tasted.

Returns:
the wines tasted by the user (type: list of wine objects)