[docs] [issue24148] 'cum' not a valid sort key for pstats.Stats.sort_stats

ramiro report at bugs.python.org
Sat May 9 17:19:17 CEST 2015


New submission from ramiro:

On the documentation page "The Python Profilers" https://docs.python.org/3.4/library/profile.html#instant-user-s-manual the following example is given:

p.sort_stats('time', 'cum').print_stats(.5, 'init')

This raises a KeyError, because 'cum' is not available as a sort key to pstats.Stats.sort_stats. As per the documentation of this method (https://docs.python.org/3.4/library/profile.html#the-stats-class) you can either use 'cumulative' or 'cumtime', which both work as expected.

Since 'cumulative' is used a few examples earlier I suggest to use that for consistency.

Tested with the following Python version:

Python 3.4.3 on Ubuntu 15.04

----------
assignee: docs at python
components: Documentation
messages: 242812
nosy: docs at python, ramiro
priority: normal
severity: normal
status: open
title: 'cum' not a valid sort key for pstats.Stats.sort_stats
type: enhancement
versions: Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24148>
_______________________________________


More information about the docs mailing list