Skip Montanaro <[EMAIL PROTECTED]> writes:
> Stephen> I have:
> Stephen> try:
> Stephen> set
> Stephen> except NameError:
> Stephen> from sets import Set as set
>
> Stephen> in my code in a few places.
>
> Yes, but then pychecker complains about a statement w
>> caused problems in the past. A module might sniff for 'set' and
>> assume it is running on 2.4 if it sees it, with unpredictable results
>> if it relies on any other 2.4 behaviour.
John> Aarrgghh! When there's a documented API (sys.version_info) for
John> determining the ve
[EMAIL PROTECTED] wrote:
> Skip Montanaro wrote:
>
> > 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
>
> (Surely just 'set' on its own is sufficient? This avoi
>> I have:
>> try:
>> set
>> except NameError:
>> from sets import Set as set
>> in my code in a few places.
Sion> Is there any reason to prefer this over the idiom I have:
Sion> if sys.version_info < (2, 4):
Sion> from sets import Set as set
No,
Stephen> I have:
Stephen> try:
Stephen> set
Stephen> except NameError:
Stephen> from sets import Set as set
Stephen> in my code in a few places.
Yes, but then pychecker complains about a statement with no apparent effect,
hence the extra verbiage.
My question was
Stephen Thorne <[EMAIL PROTECTED]> wrote:
>I have:
>try:
>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
Skip Montanaro wrote:
> 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
(Surely just 'set' on its own is sufficient? This avoids the ugly else
clause.)
> __builtin_
On Wed, 9 Mar 2005 19:49:36 -0600, Skip Montanaro <[EMAIL PROTECTED]> wrote:
>
> 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 se
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