Re: injecting "set" into 2.3's builtins?

2005-03-14 Thread Pete Forman
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

Re: injecting "set" into 2.3's builtins?

2005-03-11 Thread Skip Montanaro
>> 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

Re: injecting "set" into 2.3's builtins?

2005-03-11 Thread John Machin
[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

Re: injecting "set" into 2.3's builtins?

2005-03-11 Thread Skip Montanaro
>> 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,

Re: injecting "set" into 2.3's builtins?

2005-03-11 Thread Skip Montanaro
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

Re: injecting "set" into 2.3's builtins?

2005-03-11 Thread Sion Arrowsmith
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

Re: injecting "set" into 2.3's builtins?

2005-03-11 Thread and-google
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_

Re: injecting "set" into 2.3's builtins?

2005-03-10 Thread Stephen Thorne
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

injecting "set" into 2.3's builtins?

2005-03-10 Thread Skip Montanaro
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