[Tutor] Should I subclass UserDict or dict?

Terry Carroll carroll@tjc.com
Sun May 11 15:52:01 2003


On Sat, 10 May 2003, Magnus Lyck=E5 wrote:

> At 19:13 2003-05-09 -0700, Terry Carroll wrote:
> >Should I inherit from the
> >built-in dict class or from UserDict?
>=20
> Use dict if you don't need to support Python versions < 2.2, and don't
> plan to make the classes persistent with the ZOPE Object DataBase.

I guess that's my question: how many likely users would I have running 2.=
1=20
or earlier.

> >(my ISP's highest level of Python is 2.1.1, for example), or should I =
use
>=20
> My ISP upgraded to 2.2 when I asked them. Have you asked?
> (Don't forget to say please. :)

No, and they probably would.  But I'm not complaining, just citing that a=
s=20
anecdotal evidence of the fact that 2.2 doesn't seem to be everywhere=20
just yet.  (I know a sample of 2, one of which is my own system, is far=20
from statistically significant, of course.)

I think I'm going to go with UserDict for the time being, unless I see=20
something in 2.2 classes that I could use; for example, I'm thinking of=20
using properties, too, in which case I need 2.2 classes, and might as wel=
l=20
use dict.

--=20
Terry Carroll        |  "To have this rare opportunity
Santa Clara, CA      |    is a rare opportunity."
carroll@tjc.com      |    - Houston Rockets' Yao Ming, on being named
Modell delendus est  |    starting center for the 2003 NBA All-Star Game