[Tutor] Newbie struggling with Tkinter/canvas tags

Kent Johnson kent37 at tds.net
Mon Jan 31 13:34:21 CET 2005


Kent Johnson wrote:
> Note that Python 2.4 has set built-in with the name 'set'. To be 
> compatible with both you could write
> try:
>   set
> except NameError:
>   from sets import Set as set

Clarification: you don't _have_ to do this to be compatible with 2.4. The sets module is in both 2.3 
and 2.4. The difference in 2.4 is that set is also a built-in data type implemented in C with the 
same interface as sets.Set. The code above will take advantage of the built-in set if it is 
available, otherwise use sets.Set.

Kent



More information about the Tutor mailing list