deprecated python 2.5

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • bussiere maillist

    #1

    deprecated python 2.5

    DeprecationWarn ing: struct integer overflow masking is deprecated
    return struct.pack('>H ', ~value)
    i didn't understand if someone have some explanation
    and what uses instead.
  • John Machin

    #2
    Re: deprecated python 2.5

    bussiere maillist wrote:
    DeprecationWarn ing: struct integer overflow masking is deprecated
    return struct.pack('>H ', ~value)
    i didn't understand if someone have some explanation
    and what uses instead.
    Which 2.5 are you using? Mine (2.5c1, win32) gives me *TWO* messages,
    the second of which hints at the obvious remedy:

    | DOS prompt>\python2 5\python
    | Python 2.5c1 (r25c1:51305, Aug 17 2006, 10:41:11) [MSC v.1310 32 bit
    (Intel)] on
    | win32
    | Type "help", "copyright" , "credits" or "license" for more
    information.
    | >>import struct
    | >>struct.pack(' >H', 1)
    | '\x00\x01'
    | >>struct.pack(' >H', ~1)
    | __main__:1: DeprecationWarn ing: struct integer overflow masking is
    deprecated
    | __main__:1: DeprecationWarn ing: 'H' format requires 0 <= number <=
    65535
    | '\xff\xfe'
    | >>^Z
    |
    | DOS prompt>\python2 5\python
    | Python 2.5c1 (r25c1:51305, Aug 17 2006, 10:41:11) [MSC v.1310 32 bit
    (Intel)] on
    | win32
    | Type "help", "copyright" , "credits" or "license" for more
    information.
    | >>import struct
    | >>struct.pack(' >H', (~1) & 0xffff)
    | '\xff\xfe'
    | >>>

    HTH,
    John

    Comment

    Working...