home.social

#pprint — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #pprint, aggregated by home.social.

fetched live
  1. @hamatti
    Tip: it's probably better to prefer pprint.pp() over pprint.pprint() because pprint() sorts dictionaries by default, which can be surprising now that dictionaries maintain insertion order.

    pprint.pp() was added in Python 3.8 so is available for all supported versions.

    docs.python.org/3/library/ppri

    github.com/python/cpython/issu

    #Python #pprint

  2. @hamatti
    Tip: it's probably better to prefer pprint.pp() over pprint.pprint() because pprint() sorts dictionaries by default, which can be surprising now that dictionaries maintain insertion order.

    pprint.pp() was added in Python 3.8 so is available for all supported versions.

    docs.python.org/3/library/ppri

    github.com/python/cpython/issu

    #Python #pprint

  3. @treyhunner Somewhat related: we should generally prefer pprint.pp() over pprint.pprint(), because dictionaries now maintain order but pprint.pprint() sorts them before printing, which can be surprising.

    docs.python.org/3/library/ppri #Python #pprint

  4. @treyhunner Somewhat related: we should generally prefer pprint.pp() over pprint.pprint(), because dictionaries now maintain order but pprint.pprint() sorts them before printing, which can be surprising.

    docs.python.org/3/library/ppri #Python #pprint

  5. TIL `pprint.pprint(data, sort_dicts=False)` to keep the original order of dictionary keys. Very handy for pretty-printing dataframe.to_dict() for deeper inspection!

  6. TIL `pprint.pprint(data, sort_dicts=False)` to keep the original order of dictionary keys. Very handy for pretty-printing dataframe.to_dict() for deeper inspection!

    #datascience #python #pandas #pprint