DEAP / deap

Distributed Evolutionary Algorithms in Python
http://deap.readthedocs.org/
GNU Lesser General Public License v3.0
5.88k stars 1.13k forks source link

Logbook stream should print header if no records #694

Open bje- opened 1 year ago

bje- commented 1 year ago

Even if there are no records yet, calling stream() on the logbook should print just the header. I've described it by updating the doctest to show what I mean:

            >>> log = Logbook()
            >>> print log.stream  # doctest: +NORMALIZE_WHITESPACE
            gen
            >>> log.append({'gen' : 0})
            >>> print log.stream  # doctest: +NORMALIZE_WHITESPACE
            0
            >>> log.append({'gen' : 1})
            >>> print log.stream  # doctest: +NORMALIZE_WHITESPACE
            1

This is important when it takes a while for the results of generation 0 to appear.