def get_subperiods(self, unit):
        """
            Return the list of all the periods of unit ``unit`` contained in self.

            Examples:

            >>> period('2017').get_subperiods(MONTH)
            >>> [period('2017-01'), period('2017-02'), ... period('2017-12')]

            >>> period('year:2014:2').get_subperiods(YEAR)
            >>> [period('2014'), period('2015')]
        """
        if unit_weight(self.unit) < unit_weight(unit):
            raise ValueError('Cannot subdivide {0} into {1}'.format(self.unit, unit))

        if unit == YEAR:
            return [self.this_year.offset(i, YEAR) for i in range(self.size)]

        if unit == MONTH:
            return [self.first_month.offset(i, MONTH) for i in range(self.size_in_months)]

        if unit == DAY:
            return [self.first_day.offset(i, DAY) for i in range(self.size_in_days)]
def get_subperiods ( self , unit ) : if unit_weight ( self . unit ) < unit_weight ( unit ) : raise ValueError ( 'Cannot subdivide {0} into {1}' . format ( self . unit , unit ) ) if unit == YEAR : return [ self . this_year . offset ( i , YEAR ) for i in range ( self . size ) ] if unit == MONTH : return [ self . first_month . offset ( i , MONTH ) for i in range ( self . size_in_months ) ] if unit == DAY : return [ self . first_day . offset ( i , DAY ) for i in range ( self . size_in_days ) ]
Return the list of all the periods of unit ``unit`` contained in self.

            Examples:

            >>> period('2017').get_subperiods(MONTH)
            >>> [period('2017-01'), period('2017-02'), ... period('2017-12')]

            >>> period('year:2014:2').get_subperiods(YEAR)
            >>> [period('2014'), period('2015')]