Re: [Tutor] report service

2007-02-19 Thread János Juhász
Dear Kent, May someone recommend any simple solution to distribute some dozen parametrizable sql reports for some dozen users with a minimal access controll. Some kind of charting possibilty needed, but I needn't web-based front end. I'm not sure I understand your requirements. Do you

[Tutor] What is the augmented assignment operator ^=

2007-02-19 Thread Dick Moores
The docs list it at http://docs.python.org/ref/augassign.html, and send you to http://docs.python.org/ref/primaries.html#primaries, which seems a dead end. I've tried ^= out a bit: n = 5 n ^= 8 n 13 n ^= 8 n 5 n ^= 8 n 13 n ^= 8 n 5 and get that strange alternating behavior.

Re: [Tutor] control multiple FTP sessions using multiple ipconnectionsvia different com ports

2007-02-19 Thread ray sa
Hi Well now I have configured an old machine in the garage to run at the same time. I would really like to find out how to do this as it must be possible. I have been googling like mad and can't find how. Kind of frustrating when you don't know how. At the same time a challenge to

Re: [Tutor] What is the augmented assignment operator ^=

2007-02-19 Thread Rikard Bosnjakovic
On 2/19/07, Dick Moores [EMAIL PROTECTED] wrote: I've tried ^= out a bit: [...] and get that strange alternating behavior. Can someone explain? And while at it, please also explain = and |=. ^ is XOR, is AND, | is OR, all bitwise. You can read more about them here:

Re: [Tutor] What is the augmented assignment operator ^=

2007-02-19 Thread Andre Engels
2007/2/19, Dick Moores [EMAIL PROTECTED]: The docs list it at http://docs.python.org/ref/augassign.html, and send you to http://docs.python.org/ref/primaries.html#primaries, which seems a dead end. I've tried ^= out a bit: n = 5 n ^= 8 n 13 n ^= 8 n 5 n ^= 8 n 13 n ^= 8 n 5 and get

Re: [Tutor] control multiple FTP sessions using multiple ipconnectionsvia different com ports

2007-02-19 Thread Kent Johnson
ray sa wrote: Hi Well now I have configured an old machine in the garage to run at the same time. I would really like to find out how to do this as it must be possible. I have been googling like mad and can't find how. Kind of frustrating when you don't know how. At the same time a

Re: [Tutor] What is the augmented assignment operator ^=

2007-02-19 Thread Dick Moores
At 02:17 AM 2/19/2007, Andre Engels wrote: To understand these operators, you will have to think of the numbers as binary numbers. Look at the digits. For two numbers x and y, x^y is the effect of doing an exclusive or on all digits (that is, 0^1 = 1^0 = 1 and 0^0 = 1^1 = 0), of doing an and

Re: [Tutor] report service

2007-02-19 Thread Kent Johnson
János Juhász wrote: Dear Kent, May someone recommend any simple solution to distribute some dozen parametrizable sql reports for some dozen users with a minimal access controll. Some kind of charting possibilty needed, but I needn't web-based front end. I'm not sure I

Re: [Tutor] What is the augmented assignment operator ^=

2007-02-19 Thread Kent Johnson
Dick Moores wrote: The docs list it at http://docs.python.org/ref/augassign.html, and send you to http://docs.python.org/ref/primaries.html#primaries, which seems a dead end. a += n is more-or-less a shortcut for a = a + n. There are a few subtleties which the first page you reference talks

Re: [Tutor] What is the augmented assignment operator ^=

2007-02-19 Thread Dick Moores
At 03:32 AM 2/19/2007, you wrote: Dick Moores wrote: The docs list it at http://docs.python.org/ref/augassign.html, and send you to http://docs.python.org/ref/primaries.html#primaries, which seems a dead end. a += n is more-or-less a shortcut for a = a + n. There are a few subtleties which the

Re: [Tutor] What is the augmented assignment operator ^=

2007-02-19 Thread Andre Engels
2007/2/19, Dick Moores [EMAIL PROTECTED]: At 02:17 AM 2/19/2007, Andre Engels wrote: To understand these operators, you will have to think of the numbers as binary numbers. Look at the digits. For two numbers x and y, x^y is the effect of doing an exclusive or on all digits (that is, 0^1 = 1^0

Re: [Tutor] What is the augmented assignment operator ^=

2007-02-19 Thread Rikard Bosnjakovic
On 2/19/07, Dick Moores [EMAIL PROTECTED] wrote: It's the remaining seven I'm wondering about, or really about , , , ^, and | . This webpage will tell you - in detail - about all the operators: http://www.lnf.infn.it/Calcolo/doc/aixcxx/html/language/ref/ruclxbin.htm The bitwise operators are

Re: [Tutor] What is the augmented assignment operator ^=

2007-02-19 Thread Alan Gauld
Dick Moores [EMAIL PROTECTED] wrote Thanks, Andre! I've got it for the three operators, for non-negative integers. But I'm not sure I understand how negative integers work. For example, is 3 -3 = 1 because it is 11 -11 = 01, and that's because one of the first digits of 11 and -11 is not

[Tutor] Struct the solution for Hex translation

2007-02-19 Thread Johan Geldenhuys
Hi all, I read in some conversations that the struct module maybe helpful in converting Hex values to binary or decimal. Maybe I understood it incorrectly. Here is my problem. I have a 22 byte data packet on a tcp socket connection. My data field is from the 6th byte to byte 20. 14 bytes in

Re: [Tutor] control multiple FTP sessions using multiple ipconnectionsvia different com ports

2007-02-19 Thread David Perlman
This kind of thing is usually handled at the level of the OS's routing table. Routing tables have an entry called metric that is used to weight the different routes, so that when there are multiple possible links available, the one with the lowest metric is used first. In Unix at least,

Re: [Tutor] Struct the solution for Hex translation

2007-02-19 Thread Alan Gauld
Johan Geldenhuys [EMAIL PROTECTED] wrote The first two bytes of the data is a 16 bit value. Eg: \xe2\x01' I can the first byte into binary if I use 'e2', but I don't know how to get the '\x' out of the first byte to use it in python. Are you sure it is there? Usually the \x is only part

Re: [Tutor] What is the augmented assignment operator ^=

2007-02-19 Thread Dick Moores
My sincere thanks to Rikard Bosnjakovic, Andre Engels, and Alan Gauld. I think you've given me a good start toward understanding the operators , , , ^, and | ; 32-bit numbers, and negative binary numbers. Dick Moores ___ Tutor maillist -

Re: [Tutor] Struct the solution for Hex translation

2007-02-19 Thread Johan Geldenhuys
Here is what I have: data '\xa5\x16\x0b\x0b\x00\xd5\x01\x01\x01\x00\x00\xe3\x84(\x01\xc6\x00\x00\x17\x 01C\xc7' data[0] '\xa5' len(data[0]) 1 You see that data[0] is only one byte and it doesn't see all four characters. If I want to do this: int(data[0], 16) File console, line 1, in ?

[Tutor] Where is the __builtin__ module?

2007-02-19 Thread Dick Moores
import __builtin__ occurs frequently in files in Lib/, but I'm unable to find a module named __builtin__ or __builtin__.py anywhere in my Python 2.5. Is there one? If there is, where is it? Thanks, Dick Moores ___ Tutor maillist -

Re: [Tutor] Struct the solution for Hex translation

2007-02-19 Thread David Perlman
You're way off base... :) On Feb 19, 2007, at 9:25 AM, Johan Geldenhuys wrote: Here is what I have: data '\xa5\x16\x0b\x0b\x00\xd5\x01\x01\x01\x00\x00\xe3\x84(\x01\xc6\x00 \x00\x17\x 01C\xc7' data[0] '\xa5' len(data[0]) 1 You see that data[0] is only one byte and it doesn't see

[Tutor] Main program confusion

2007-02-19 Thread Hazlett, Les
Hello, I am trying to understand some sample code that includes the following for a main program: def runTest(frame, nb, log): win = TestPanel(nb, log) return win if __name__ == '__main__': import sys,os import run run.main(['', os.path.basename(sys.argv[0])] +

Re: [Tutor] Struct the solution for Hex translation

2007-02-19 Thread Alan Gauld
Johan Geldenhuys [EMAIL PROTECTED] wrote data '\xa5\x16\x0b\x0b\x00\xd5\x01\x01\x01\x00\x00\xe3\x84(\x01\xc6\x00\x00\x17\x 01C\xc7' data[0] '\xa5' len(data[0]) 1 OK, So that tells you that you have one byte. The '\xa5' is a 4 character representation of that byte but it is only one byte

Re: [Tutor] Where is the __builtin__ module?

2007-02-19 Thread Rikard Bosnjakovic
On 2/19/07, Dick Moores [EMAIL PROTECTED] wrote: Is there one? If there is, where is it? Yes, there is one. It'sbuiltin(!) in the interpreter! ;-) -- - Rikard. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Where is the __builtin__ module?

2007-02-19 Thread Alan Gauld
Dick Moores [EMAIL PROTECTED] wrote import __builtin__ occurs frequently in files in Lib/, Really? I'm surprised, I can't think why. unable to find a module named __builtin__ or __builtin__.py anywhere in my Python 2.5. Is there one? If there is, where is it? It's C code so it's not a .py

Re: [Tutor] Main program confusion

2007-02-19 Thread Dave Kuhlman
On Mon, Feb 19, 2007 at 10:15:08AM -0600, Hazlett, Les wrote: if __name__ == '__main__': import sys,os import run run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:]) [snip] if__name__=='__main__' only runs when this program file is executed. But, I can't find any

Re: [Tutor] Main program confusion

2007-02-19 Thread Luke Paireepinart
Hazlett, Les wrote: Hello, I am trying to understand some sample code that includes the following for a main program: def runTest(frame, nb, log): win = TestPanel(nb, log) return win if __name__ == '__main__': import sys,os import run run.main(['',

Re: [Tutor] control multiple FTP sessions using multiple ipconnectionsvia different com ports

2007-02-19 Thread Alan Gauld
David Perlman [EMAIL PROTECTED] wrote first. In Unix at least, you'll be able to use either the command route or routed to manually change the routing table; I don't think the routing systems on ordinary computers were designed with the idea in mind that you might want to use a

Re: [Tutor] Where is the __builtin__ module?

2007-02-19 Thread Kent Johnson
Rikard Bosnjakovic wrote: On 2/19/07, Dick Moores [EMAIL PROTECTED] wrote: Is there one? If there is, where is it? Yes, there is one. It'sbuiltin(!) in the interpreter! ;-) More info here: http://docs.python.org/lib/module-builtin.html Kent

Re: [Tutor] Main program confusion

2007-02-19 Thread [EMAIL PROTECTED]
It's wxpython demo's code. It's necessary to have the run.py in the same path, to make it run, and usually also some other files. -- Tom, http://www.vscripts.net I've never heard of this module. Where did this code come from? ___ Tutor maillist -

[Tutor] Main program confusion

2007-02-19 Thread Hazlett, Les
Dave, Thanks for the guidance. I followed your advice and learned the following: import run print run module:, run run module: module 'run' from 'C:\Python25\Lib\idlelib\run.pyc' The run.py file is there also. I can read but not understand what run.py does. It may be something new in

Re: [Tutor] Main program confusion

2007-02-19 Thread Kent Johnson
Hazlett, Les wrote: Dave, Thanks for the guidance. I followed your advice and learned the following: import run print run module:, run run module: module 'run' from 'C:\Python25\Lib\idlelib\run.pyc' I don't think that is the correct run.py. Luke, I found this mystery main

[Tutor] Main program confusion

2007-02-19 Thread Hazlett, Les
Thanks Kent, Yes, there is a run.py in the demo folder. I is the one that runs and not the one in the Python25 lib. So, I tried to see if I could find it if I previously imported everything that the code imports. It didn't - see below: IDLE 1.2 import wx import sys,os

Re: [Tutor] Main program confusion

2007-02-19 Thread Luke Paireepinart
Hazlett, Les wrote: Thanks Kent, Yes, there is a run.py in the demo folder. I is the one that runs and not the one in the Python25 lib. So, I tried to see if I could find it if I previously imported everything that the code imports. It didn’t – see below: IDLE 1.2 import wx

Re: [Tutor] Accessing class attributes: use methods only?

2007-02-19 Thread Chris Lasher
Thanks very much for your responses, all. Just to clarify, yes, by through class methods I actually meant through methods of instances of a class. Now for more discussion: I'm confused. On the one hand we have Mr. Kent Johnson's statement: On 2/13/07, Kent Johnson [EMAIL PROTECTED] wrote:

Re: [Tutor] Accessing class attributes: use methods only?

2007-02-19 Thread Python
On Mon, 2007-02-19 at 18:31 -0500, Chris Lasher wrote: I'm used to just setting and getting attributes straight, which would be Pythonic according to Kent and yet also outright wrong according to Alan and academic papers. So is direct access actually not Pythonic, or is it Pythonic and

Re: [Tutor] Accessing class attributes: use methods only?

2007-02-19 Thread Alan Gauld
Chris Lasher [EMAIL PROTECTED] wrote Now for more discussion: I'm confused. :-) Actually there is no real contradiction. I'll try to explain and if I misrepresent Kent I'm sure he'll say so! Kent Johnson's statement: Python practice is to use direct attribute access. If you need to do

Re: [Tutor] Accessing class attributes: use methods only?

2007-02-19 Thread Chris Lasher
Ah ha! All is clear, now. I understand what I misinterpreted in your first post, Alan. Thanks also to Lloyd for reinforcing the concept. Much appreciated! Chris ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Struct the solution for Hex translation

2007-02-19 Thread Johan Geldenhuys
Thanks, Dave. On the struct module, How can I het the binary 1's and 0's of the Hex value? Let say I want to get the 8 bit value of '\xe2', can I use struct to convert that into binary code so that I get 8 binary bits as a string? Thanks for helping with struct. Johan -Original