On Tuesday 16 May 2006 16:01, Alan Gauld wrote: > Terry, > > Your approach is fine. Personally however I'd just have defined > some constants and done a direct bitwise and - this is the > approach used in the stat module: > > VMASK = 0x14 # 00011000 > VER00 = 0x00 > VER01 = 0x04 > VER10 = 0x10 > VER11 = 0x14 > > version = byte & VMASK > if version == VER00: #do something > elif version == VER01: # do another
> Alan Gauld Whoops, a typo I think. VMASK = 0x18 #00011000 or VMASK = 0x14 #00010100 Stan _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor