injecting "set" into 2.3's builtins?

Sion Arrowsmith siona at
Fri Mar 11 14:05:00 CET 2005

Stephen Thorne  <stephen.thorne at> wrote:
>I have:
>    set
>except NameError:
>    from sets import Set as set
>in my code in a few places.

Is there any reason to prefer this over the idiom I have:
if sys.version_info < (2, 4):
    from sets import Set as set

? (I've also used the same kind of trick to provide enumerate when a
script is being run with pre-2.3.)

\S -- siona at --
  ___  |  "Frankly I have no feelings towards penguins one way or the other"
  \X/  |    -- Arthur C. Clarke
   her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump

More information about the Python-list mailing list