minor patch using the set builtin
Mario Pernici
Mario.Pernici at mi.infn.it
Thu May 19 09:03:22 BST 2005
On Thu, 19 May 2005, Martin Pool wrote:
> > -one can use the built-ins basestring and set instead of
> > types.StringTypes and sets.Set respectively (see attached patch);
>
> Actually, we can only use the set builtin in Python2.4 and later; for
> 2.3 which is still supported by bzr we need to use sets.Set.
> (I thought they would fold down to the same thing, but apparently
> sets.Set still gives the one written on top of a dict, which is probably
> a lot slower.)
>
The patch should work also in Python2.3 :
$ python2.3
>>> try: set
... except NameError: from sets import Set as set
...
>>> a = set([1,2])
>>> 1 in a
True
Mario
More information about the bazaar
mailing list