Module match :: Class Match
[hide private]
[frames] | no frames]

Class Match

source code

object --+
         |
        Match

The class Match represents match results in a football match statistics program. A match is played between teams from two clubs: a home club and an away club. Goals scored by either team can be added to the match object with the method add_goal. The class is expected to be used so that a match object is initially created as a real-life match starts and goals are added incrementally as the match progresses.

Instance Methods [hide private]
 
__init__(self, home_club, away_club)
Constructs a match between teams of the given clubs, with no goals scored (yet).
source code
 
get_home_club(self)
Returns the club who hosts the match.
source code
 
get_away_club(self)
Returns the club who is visiting the home club to play the match.
source code
 
add_home_goal(self)
Records a goal as having been scored in the match by the home team.
source code
 
add_away_goal(self)
Records a goal as having been scored in the match by the away team.
source code
 
get_home_goals(self)
Returns the number of goals scored by the home team.
source code
 
get_away_goals(self)
Returns the number of goals scored by the away team.
source code
 
get_goal_difference(self)
Returns the goal difference of the match.
source code
 
get_total_goals(self)
Returns the total number of goals scored by the two teams.
source code
 
is_home_win(self)
Returns a boolean value indicating if the home team won.
source code
 
is_away_win(self)
Returns a boolean value indicating if the away team won.
source code
 
is_drawn(self)
Returns a boolean value indicating if the match ended in a draw.
source code
 
is_higher_scoring_than(self, another_match)
Returns a boolean value indicating if the match had a higher number of goals than another given match.
source code
 
get_location(self)
Returns the name of the stadium at which the game is played.
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, home_club, away_club)
(Constructor)

source code 

Constructs a match between teams of the given clubs, with no goals scored (yet).

Parameters:
  • home_club - the club whose team plays at home in the match
  • away_club - the club whose team plays away in the match
Overrides: object.__init__

get_home_club(self)

source code 

Returns the club who hosts the match.

Returns:
home club

get_away_club(self)

source code 

Returns the club who is visiting the home club to play the match.

Returns:
away club

get_home_goals(self)

source code 

Returns the number of goals scored by the home team.

Returns:
home team's goal count

get_away_goals(self)

source code 

Returns the number of goals scored by the away team.

Returns:
away team's goal count

get_goal_difference(self)

source code 

Returns the goal difference of the match. If the home team won, a positive integer indicating the win margin is returned. Similarly, a negative integer indicates an away win. A tied match has a goal difference of zero.

Returns:
goal difference

get_total_goals(self)

source code 

Returns the total number of goals scored by the two teams.

Returns:
total goal count

is_home_win(self)

source code 

Returns a boolean value indicating if the home team won.

Returns:
True if the home team won, False otherwise

is_away_win(self)

source code 

Returns a boolean value indicating if the away team won.

Returns:
True if the away team won, False otherwise

is_drawn(self)

source code 

Returns a boolean value indicating if the match ended in a draw.

Returns:
True if the neither team won, False otherwise

is_higher_scoring_than(self, another_match)

source code 

Returns a boolean value indicating if the match had a higher number of goals than another given match.

Parameters:
  • another_match - another match which this match is compared to
Returns:
True if this match had a higher total number of goals than the given one, False otherwise

See Also: #getTotalGoals()

get_location(self)

source code 

Returns the name of the stadium at which the game is played. That is, returns the home club's home stadium.

Returns:
stadium name