Author: Lukas Diekmann <lukas.diekm...@uni-duesseldorf.de> Branch: list-strategies Changeset: r47559:b4d8d7f596eb Date: 2011-09-19 14:11 +0200 http://bitbucket.org/pypy/pypy/changeset/b4d8d7f596eb/
Log: added docstring got EmptyListStrategy and RangeListStrategy diff --git a/pypy/objspace/std/listobject.py b/pypy/objspace/std/listobject.py --- a/pypy/objspace/std/listobject.py +++ b/pypy/objspace/std/listobject.py @@ -278,7 +278,11 @@ raise NotImplementedError class EmptyListStrategy(ListStrategy): - # XXX add a docstring and say what the storage is + """EmptyListStrategy is used when a W_List withouth elements is created. + The storage is None. When items are added to the W_List a new RPython list + is created and the strategy and storage of the W_List are changed depending + to the added item. + W_Lists do not switch back to EmptyListStrategy when becoming empty again.""" def __init__(self, space): ListStrategy.__init__(self, space) @@ -368,7 +372,11 @@ pass class RangeListStrategy(ListStrategy): - # XXX add a docstring what the storage looks like + """RangeListStrategy is used when a list is created using the range method. + The storage is a tuple containing only three integers start, step and length + and elements are calculated based on these values. + On any operation destroying the range (inserting, appending non-ints) + the strategy is switched to IntegerListStrategy.""" def switch_to_integer_strategy(self, w_list): items = self._getitems_range(w_list, False) _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit