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

struct,long on 64-bit machine

P: n/a
What's wrong with this?
type(struct.unpack('l','\00'*8)[0])
<type 'int'>

Why I am getting 'int' when I asked for 'long'?

This is on python-2.5.1-15.fc8.x86_64

Nov 19 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Neal Becker <nd*******@gmail.comwrites:
What's wrong with this?
type(struct.unpack('l','\00'*8)[0])
<type 'int'>

Why I am getting 'int' when I asked for 'long'?
C longs are converted to Python integers; see the table on
http://docs.python.org/lib/module-struct.html. If you really need the
Python long, use long(...).
Nov 19 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.