UserList - which methods needs to be overriden?

Maxime S maxischmeii at gmail.com
Fri Jun 10 06:11:05 EDT 2016


2016-06-10 10:37 GMT+02:00 Peter Otten <__peter__ at web.de>:
>
> Nagy László Zsolt wrote:
>
> > I'm not sure wich one is the best. Peter wrote that UserList was left in
> > collections only for backward compatiblity. This might be a point
>
> I'll take that back. I looked around and found no evidence for my claim.
> Only MutableString was removed during the transition to Python 3.
>
> Sorry for the confusion.
>
>

Up to Python 2.6, the docs of UserList had a note stating that:

This module is available for backward compatibility only. If you are
writing code that does not need to work with versions of Python earlier
than Python 2.2, please consider subclassing directly from the built-in
list type.

This was changed in Python 2.7 to:

When Python 2.2 was released, many of the use cases for this class were
subsumed by the ability to subclass list directly. However, a handful of
use cases remain.

So I think the intention was that the ability to subclass list would remove
the need to subclass UserList, but it was later realised that it is not
totally the case.



More information about the Python-list mailing list