injecting "set" into 2.3's builtins?
From: Skip Montanaro (skip_at_pobox.com)
Date: 03/10/05
- Next message: David Eppstein: "Re: [perl-python] a program to delete duplicate files"
- Previous message: Skip Montanaro: "Re: Is there a short-circuiting dictionary "get" method?"
- Next in thread: Stephen Thorne: "Re: injecting "set" into 2.3's builtins?"
- Maybe reply: Stephen Thorne: "Re: injecting "set" into 2.3's builtins?"
- Reply: and-google_at_doxdesk.com: "Re: injecting "set" into 2.3's builtins?"
- Maybe reply: Skip Montanaro: "Re: injecting "set" into 2.3's builtins?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 9 Mar 2005 19:49:36 -0600 To: python-list@python.org
I use sets a lot in my Python 2.3 code at work and have been using this
hideous import to make the future move to 2.4's set type transparent:
try:
x = set
except NameError:
from sets import Set as set
else:
del x
Of course, while it's transparent at one level (where sets are used) it's
not really transparent at another level (where the set object is defined).
I'm toying with the idea of adding this to the sitecustomize module at work:
import sets
import __builtin__
__builtin__.set = sets.Set
del sets, __builtin__
I'm wondering if others have tried it. If so, did it cause any problems?
I've not noticed any incompatibilities between the 2.3 and 2.4 versions of
set objects, but my use of them has been pretty straightforward.
Thanks,
Skip
- Next message: David Eppstein: "Re: [perl-python] a program to delete duplicate files"
- Previous message: Skip Montanaro: "Re: Is there a short-circuiting dictionary "get" method?"
- Next in thread: Stephen Thorne: "Re: injecting "set" into 2.3's builtins?"
- Maybe reply: Stephen Thorne: "Re: injecting "set" into 2.3's builtins?"
- Reply: and-google_at_doxdesk.com: "Re: injecting "set" into 2.3's builtins?"
- Maybe reply: Skip Montanaro: "Re: injecting "set" into 2.3's builtins?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|