By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,814 Members | 1,050 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,814 IT Pros & Developers. It's quick & easy.

Type discrepancy using struct.unpack

P: n/a
Hallo,

I have a 64 bit server with CentOS 4.3 installed, running Python.

[pymsnt@lutetium pymsnt-0.11.2]$ uname -a
Linux lutetium.mxit.co.za 2.6.9-34.ELsmp #1 SMP Thu Mar 9 06:23:23 GMT
2006 x86_64 x86_64 x86_64 GNU/Linux

Consider the following two snippets, issuing a struct.unpack(...) using
Python 2.3.4 and Python 2.5 respectively.

[pymsnt@lutetium pymsnt-0.11.2]$ python
Python 2.5 (r25:51908, Oct 17 2006, 10:34:59)
[GCC 3.4.5 20051201 (Red Hat 3.4.5-2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>import struct
print type(struct.unpack(">L", "xxxx")[0])
<type 'int'>
>>>
[pymsnt@lutetium pymsnt-0.11.2]$ /usr/bin/python2.3
Python 2.3.4 (#1, Feb 17 2005, 21:01:10)
[GCC 3.4.3 20041212 (Red Hat 3.4.3-9.EL4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>import struct
print type(struct.unpack(">L", "xxxx")[0])
<type 'long'>
>>>
I would expect <type 'long'in both cases. Why is this not so?

Regards
Pieter Rautenbach

Oct 19 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a

Pieter Rautenbach wrote:
Hallo,

I have a 64 bit server with CentOS 4.3 installed, running Python.

[pymsnt@lutetium pymsnt-0.11.2]$ uname -a
Linux lutetium.mxit.co.za 2.6.9-34.ELsmp #1 SMP Thu Mar 9 06:23:23 GMT
2006 x86_64 x86_64 x86_64 GNU/Linux

Consider the following two snippets, issuing a struct.unpack(...) using
Python 2.3.4 and Python 2.5 respectively.

[pymsnt@lutetium pymsnt-0.11.2]$ python
Python 2.5 (r25:51908, Oct 17 2006, 10:34:59)
[GCC 3.4.5 20051201 (Red Hat 3.4.5-2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>import struct
print type(struct.unpack(">L", "xxxx")[0])
<type 'int'>
>>

[pymsnt@lutetium pymsnt-0.11.2]$ /usr/bin/python2.3
Python 2.3.4 (#1, Feb 17 2005, 21:01:10)
[GCC 3.4.3 20041212 (Red Hat 3.4.3-9.EL4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>import struct
print type(struct.unpack(">L", "xxxx")[0])
<type 'long'>
>>

I would expect <type 'long'in both cases. Why is this not so?
http://mail.python.org/pipermail/pyt...ay/065199.html

-- Leo.

Oct 19 '06 #2

P: n/a

Leo Kislov wrote:
Pieter Rautenbach wrote:
Hallo,

I have a 64 bit server with CentOS 4.3 installed, running Python.

[pymsnt@lutetium pymsnt-0.11.2]$ uname -a
Linux lutetium.mxit.co.za 2.6.9-34.ELsmp #1 SMP Thu Mar 9 06:23:23 GMT
2006 x86_64 x86_64 x86_64 GNU/Linux

Consider the following two snippets, issuing a struct.unpack(...) using
Python 2.3.4 and Python 2.5 respectively.

[pymsnt@lutetium pymsnt-0.11.2]$ python
Python 2.5 (r25:51908, Oct 17 2006, 10:34:59)
[GCC 3.4.5 20051201 (Red Hat 3.4.5-2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>import struct
>>print type(struct.unpack(">L", "xxxx")[0])
<type 'int'>
>>>
[pymsnt@lutetium pymsnt-0.11.2]$ /usr/bin/python2.3
Python 2.3.4 (#1, Feb 17 2005, 21:01:10)
[GCC 3.4.3 20041212 (Red Hat 3.4.3-9.EL4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>import struct
>>print type(struct.unpack(">L", "xxxx")[0])
<type 'long'>
>>>
I would expect <type 'long'in both cases. Why is this not so?

http://mail.python.org/pipermail/pyt...ay/065199.html

-- Leo.
Thanks a lot!

Oct 19 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.