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

Class User

source code

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)
Constructor.
source code
 
add_wine(self, new_wine)
Adds a new wine to the user's list of tasted wines.
source code
 
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.
source code
 
get_tasted_wines(self)
Returns a list of all the wines the user has tasted.
source code

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)

source code 

Constructor. Creates a new user who has tasted no wines yet.

Overrides: object.__init__

add_wine(self, new_wine)

source code 

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

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

get_favorite(self)

source code 

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

get_tasted_wines(self)

source code 

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

Returns:
the wines tasted by the user