old_contents: # encoding: utf-8
  
  '''
  @author: Tsuyoshi Hombashi
  '''
  
  
  class MinMaxContainer(object):
  
      @property
      def min_value(self):
          return self.__min_value
  
      @property
      def max_value(self):
          return self.__max_value
  
      def __init__(self):
          self.__min_value = None
          self.__max_value = None
  
      def diff(self):
          return self.max_value - self.min_value
  
      def mean(self):
          return (self.max_value + self.min_value) * 0.5
  
      def update(self, value):
          if self.__min_value is None:
              self.__min_value = value
          else:
              self.__min_value = min(self.__min_value, value)
  
          if self.__max_value is None:
              self.__max_value = value
          else:
              self.__max_value = max(self.__max_value, value)
  
new_contents: # encoding: utf-8
  
  '''
  @author: Tsuyoshi Hombashi
  '''
  
  
  class MinMaxContainer(object):
  
      @property
      def min_value(self):
          return self.__min_value
  
      @property
      def max_value(self):
          return self.__max_value
  
      def __init__(self):
          self.__min_value = None
          self.__max_value = None
  
      def diff(self):
          return self.max_value - self.min_value
  
      def mean(self):
          try:
              return (self.max_value + self.min_value) * 0.5
          except TypeError:
              return float("nan")
  
      def update(self, value):
          if self.__min_value is None:
              self.__min_value = value
          else:
              self.__min_value = min(self.__min_value, value)
  
          if self.__max_value is None:
              self.__max_value = value
          else:
              self.__max_value = max(self.__max_value, value)
  
subject: Modify error handling