Re: [Tutor] am I missing another simpler structure?

2004-12-16 Thread Loptr Chaote
On Wed, 15 Dec 2004 19:58:56 -0500, Brian van den Broek <[EMAIL PROTECTED]> wrote: > As I mentioned, I feel as though I have a mental block getting in the > way of coming up with code in the smoother fashion of the second snippet > above. As I have been making a lot of use of a construct (pattern?)

Re: [Tutor] Problems with unsigned integers

2004-12-13 Thread Loptr Chaote
On Mon, 13 Dec 2004 13:27:25 -0500, Kent Johnson <[EMAIL PROTECTED]> wrote: > It seems that ntohl doesn't understand about unsigned values, at least on > Win32: > Wow, I've never actually considered using the interpreter/CLI like that. Thank you! I'm writing my own u_ntohl() now which checks to

Re: [Tutor] Problems with unsigned integers

2004-12-13 Thread Loptr Chaote
On Mon, 13 Dec 2004 12:43:17 -0500, QoD SEC <[EMAIL PROTECTED]> wrote: > I do not believe that python has anything like signed and unsigned > integers. The 'L' after an integer makes the number a type long (which > is not the same as C's long). Also in your code you do this seq = > socket.ntohl(str

[Tutor] Problems with unsigned integers

2004-12-13 Thread Loptr Chaote
Hello everyone! I'm having problems with signed/unsigned (32bit) integers in python. Example code: seq = 0L seq = socket.ntohl(struct.unpack("L", data[38:42])[0]) print seq This sometimes produces a negative output, how is that possible since I booth initialized seq with "0L" and also spe