Re: Converting a set into list

2011-05-15 Thread Peter Otten
Daniel Kluev wrote: >> Both solutions seem to be equivalent in that concerns the number of >> needed loop runs, but this two-step operation might require one less loop >> over list1. The set&set solution, in contrary, might require one loop >> while transforming to a set and another one for the &

Re: obviscating python code for distribution

2011-05-15 Thread James Mills
On Mon, May 16, 2011 at 4:16 PM, Littlefield, Tyler wrote: > I understood you loud and clear. And that makes a lot of assumptions on my > game and the design. I don't really care to host this over the web. I want a > centralized server that would perform the logic, where I can offload the > playin

Re: obviscating python code for distribution

2011-05-15 Thread Littlefield, Tyler
Hello: I wanted to make the client in python, and the server possibly, though I'm not really sure on that. I was not worried about the code for the server being stolen, as much as I was worried about people tinkering with the client code for added advantages. Most of the logic can be handled b

Re: obviscating python code for distribution

2011-05-15 Thread Littlefield, Tyler
>Write your "game" for the "web". >Write is as a SaaS (Software as a Service) - even if it's free and open source. I understood you loud and clear. And that makes a lot of assumptions on my game and the design. I don't really care to host this over the web. I want a centralized server that woul

Re: obviscating python code for distribution

2011-05-15 Thread Chris Angelico
On Mon, May 16, 2011 at 3:41 PM, Littlefield, Tyler wrote: > Here's kind of what I want to prevent. I want to write a multi-player online > game; everyone will essentually end up connecting to my server to play the > game. I don't really like the idea of security through obscurity, but I > wanted

Re: obviscating python code for distribution

2011-05-15 Thread James Mills
On Mon, May 16, 2011 at 3:41 PM, Littlefield, Tyler wrote: > Here's kind of what I want to prevent. I want to write a multi-player online > game; everyone will essentually end up connecting to my server to play the > game. I don't really like the idea of security through obscurity, but I > wanted

Re: checking if a list is empty

2011-05-15 Thread rusi
On May 16, 2:36 am, Terry Reedy wrote: > On 5/15/2011 1:33 PM, rusi wrote: > > > On May 15, 10:07 am, Steven D'Aprano > +comp.lang.pyt...@pearwood.info>  wrote: > > >> I'm afraid I don't understand what you mean. Can you explain please, what > >> properties of "first class booleans" do you think a

Re: checking if a list is empty

2011-05-15 Thread rusi
I have been scolded off-list for pursuing a discussion that has nothing to do with python. So I continue a bit gingerly :-) and will stop when others feel this is useless/irrelevant/whatever. Steven wrote: > I'm afraid I didn't find your discussion about reification, Platonism and > linguistics

Re: obviscating python code for distribution

2011-05-15 Thread Littlefield, Tyler
Hello: Thanks all for your information and ideas. I like the idea of open source; I have a fairly large (or large, by my standards anyway) project that I am working on that is open source. Here's kind of what I want to prevent. I want to write a multi-player online game; everyone will essentu

Re: TypeError: __init__() takes exactly 1 positional argument (2 given)

2011-05-15 Thread Gnarlodious
Thanks for all the help, this looks like a bug in mod_wsgi. I tried it interactively under Py3.1.3 and it behaves normally. I'll take this over to the mod_wsgi group. -- Gnarlie http://Gnarlodious.com -- http://mail.python.org/mailman/listinfo/python-list

Re: TypeError: __init__() takes exactly 1 positional argument (2 given)

2011-05-15 Thread Gnarlodious
Well, I have a whole lot of scripts where I could say something like this: def __init__(self, var1, var2, var3...): Now suddenly I have to change them all to run in Python 3.1.3? This is apparently not a bug. And I rebooted still getting the same behavior. Can someone explain it? -- Gnarlie --

Re: TypeError: __init__() takes exactly 1 positional argument (2 given)

2011-05-15 Thread Ian Kelly
On Sun, May 15, 2011 at 10:30 PM, Gnarlodious wrote: > I don't have a trace because I am using mod_wsgi under Apache. Maybe > there is a way to debug using mod_wsgi but I haven't been able to > figure out how. http://code.google.com/p/modwsgi/wiki/DebuggingTechniques > My problem is that in orde

Memcached in python 3

2011-05-15 Thread Navkirat Singh
Hi Guys, How can I used memcached with python 3? Are there any other good alternatives to memcached? What about python dictionary manager, would it compare to memcached if I were to use it for storing in-memory information? Any light on this matter will be appreciated. Regards, Navkirat -- http

Re: TypeError: __init__() takes exactly 1 positional argument (2 given)

2011-05-15 Thread Chris Rebert
On Sun, May 15, 2011 at 9:30 PM, Gnarlodious wrote: > I don't have a trace because I am using mod_wsgi under Apache. Maybe > there is a way to debug using mod_wsgi but I haven't been able to > figure out how. > > My problem is that in order to run mod_wsgi I had to downgrade to > Python 3.1.3 whic

Re: obviscating python code for distribution

2011-05-15 Thread Chris Angelico
On Mon, May 16, 2011 at 2:03 PM, Steven D'Aprano wrote: > The best way to do that is to labour in obscurity, where nobody either > knows or cares about your application. There are hundreds of thousands, > possibly millions, of such applications, with a user base of one: the > creator. And I'm sur

Re: TypeError: __init__() takes exactly 1 positional argument (2 given)

2011-05-15 Thread Steven D'Aprano
On Sun, 15 May 2011 20:53:31 -0700, Gnarlodious wrote: > Can someone please explain what I am doing wrong? > > Calling script: > > from Gnomon import GnomonBase > Gnomon=GnomonBase(3) > > > Called script: > > class GnomonBase(object): > def __init__(self, bench): > # do stuff > >

Re: TypeError: __init__() takes exactly 1 positional argument (2 given)

2011-05-15 Thread Gnarlodious
I don't have a trace because I am using mod_wsgi under Apache. Maybe there is a way to debug using mod_wsgi but I haven't been able to figure out how. My problem is that in order to run mod_wsgi I had to downgrade to Python 3.1.3 which may be causing the problem. This website was running fine in P

Re: obviscating python code for distribution

2011-05-15 Thread Ben Finney
"Littlefield, Tyler" writes: > I'm putting lots of work into this. I would rather not have some > script kiddy dig through it, yank out chunks and do whatever he wants. > I just want to distribute the program as-is, not distribute it and > leave it open to being hacked. How do these arguments ap

Re: TypeError: __init__() takes exactly 1 positional argument (2 given)

2011-05-15 Thread Ian Kelly
On Sun, May 15, 2011 at 9:53 PM, Gnarlodious wrote: > class GnomonBase(object): >    def __init__(self, bench): >        # do stuff > > But all I get is: > TypeError: __init__() takes exactly 1 positional argument (2 given) > > I don't understand, I am only sending one variable. What does it think

Re: TypeError: __init__() takes exactly 1 positional argument (2 given)

2011-05-15 Thread Chris Rebert
On Sun, May 15, 2011 at 8:53 PM, Gnarlodious wrote: > Can someone please explain what I am doing wrong? > > Calling script: > > from Gnomon import GnomonBase > Gnomon=GnomonBase(3) > > > Called script: > > class GnomonBase(object): >    def __init__(self, bench): >        # do stuff > > But all I

Re: MySQLdb SEC_TO_TIME function returns datetime.timedelta class

2011-05-15 Thread Jorge Romero
On Sun, May 15, 2011 at 11:50 PM, Chris Angelico wrote: > On Mon, May 16, 2011 at 10:42 AM, Jorge Romero > wrote: > > Hi Pythonists, > > I'm retrieving some time data from a MySQL database using Python's > MySQLdb > > library. Here's the situation, I got a time field on MySQL given in > seconds,

Re: obviscating python code for distribution

2011-05-15 Thread Steven D'Aprano
On Sun, 15 May 2011 21:36:53 -0600, Littlefield, Tyler wrote: > I'm putting lots of work into this. I would rather not have some script > kiddy dig through it, yank out chunks and do whatever he wants. The best way to do that is to labour in obscurity, where nobody either knows or cares about

Re: TypeError: __init__() takes exactly 1 positional argument (2 given)

2011-05-15 Thread harrismh777
Gnarlodious wrote: class GnomonBase(object): def __init__(self, bench): <=== (1) (2) # do stuff This only answers the surface question I have not taken any time to see or understand what (if anything) you are doing which might make any sense... only that the messa

TypeError: __init__() takes exactly 1 positional argument (2 given)

2011-05-15 Thread Gnarlodious
Can someone please explain what I am doing wrong? Calling script: from Gnomon import GnomonBase Gnomon=GnomonBase(3) Called script: class GnomonBase(object): def __init__(self, bench): # do stuff But all I get is: TypeError: __init__() takes exactly 1 positional argument (2 given)

Re: MySQLdb SEC_TO_TIME function returns datetime.timedelta class

2011-05-15 Thread Chris Angelico
On Mon, May 16, 2011 at 10:42 AM, Jorge Romero wrote: > Hi Pythonists, > I'm retrieving some time data from a MySQL database using Python's MySQLdb > library. Here's the situation, I got a time field on MySQL given in seconds, > I need it on HH:MM:SS format, so I'm SELECTING that field with SEC_TO

Re: obviscating python code for distribution

2011-05-15 Thread harrismh777
Littlefield, Tyler wrote: I'm putting lots of work into this. I would rather not have some script kiddy dig through it, yank out chunks and do whatever he wants. I just want to distribute the program as-is, not distribute it and leave it open to being hacked. Protection via obfuscation is inval

Re: obviscating python code for distribution

2011-05-15 Thread Littlefield, Tyler
I'm putting lots of work into this. I would rather not have some script kiddy dig through it, yank out chunks and do whatever he wants. I just want to distribute the program as-is, not distribute it and leave it open to being hacked. On 5/15/2011 9:29 PM, Ben Finney wrote: "Littlefield, Tyler"

Re: obviscating python code for distribution

2011-05-15 Thread Ben Finney
"Littlefield, Tyler" writes: > I have been considering writing a couple of programs in Python, but I > don't want to distribute the code along with them. This topic has been raised many times before, and there is a response which is now common but may sound harsh: What is it you think you would

Re: connect SIGINT to custom interrupt handler

2011-05-15 Thread Nobody
On Sun, 15 May 2011 14:32:13 +, Christoph Scheingraber wrote: > I now have signal.siginterrupt(signal.SIGINT, False) in the line > below signal.signal(signal.SIGINT, interrupt_handler) > > Unfortunately, pressing ^c still results in the same interrupt error. Sorry; I wasn't paying sufficient

Re: obviscating python code for distribution

2011-05-15 Thread James Mills
On Mon, May 16, 2011 at 12:21 PM, Daniel Kluev wrote: > No, there is no way to prevent users from getting access to raw python > sources. By its nature and design, python is not meant to be used this > way, and even obfuscation would not harm readability much. > However, you can write all parts yo

Re: Converting a set into list

2011-05-15 Thread Daniel Kluev
> Both solutions seem to be equivalent in that concerns the number of needed > loop runs, but this two-step operation might require one less loop over list1. > The set&set solution, in contrary, might require one loop while transforming > to a set and another one for the & operation. python -m t

Re: connect SIGINT to custom interrupt handler

2011-05-15 Thread Nobody
On Sun, 15 May 2011 17:05:57 +, Christoph Scheingraber wrote: > Is it correct anyway to have > > signal.siginterrupt(signal.SIGINT, False) > > in my custom interrupt_handler function No. > or should it be outside but after > signal.signal(signal.SIGINT, interrupt_handler)? Yes. -- htt

Re: obviscating python code for distribution

2011-05-15 Thread Daniel Kluev
On Mon, May 16, 2011 at 1:04 PM, Littlefield, Tyler wrote: > Hello all: > Finally, is there a good way to accomplish this? I know that I can make .pyc > files, but those can be disassembled very very easily with the disassembler > and shipping these still means that the person needs the modules th

Re: checking if a list is empty

2011-05-15 Thread Algis Kabaila
On Friday 13 May 2011 18:47:50 Hans Georg Schaathun wrote: > On Thu, 12 May 2011 23:20:20 +1000, Chris Angelico > >wrote: > : Writing a program requires expertise both in programming snip... > > And the main difference here, is that the civil engineers > have a much better language to share

obviscating python code for distribution

2011-05-15 Thread Littlefield, Tyler
Hello all: I have been considering writing a couple of programs in Python, but I don't want to distribute the code along with them. So I'm curious of a couple things. First, does there exist a cross-platform library for playing audio files, whose license I would not be violating if I do this?

Re: checking if a list is empty

2011-05-15 Thread harrismh777
Steven D'Aprano wrote: I'm afraid I don't understand what you mean. Can you explain please, http://www.informatik.uni-bremen.de/agbkb/lehre/ws06-07/casl/slides/Datatypes-II.pdf Geeze, I wonder if software is mathematics kind regards, m harris -- http://mail.python.org/mailman/li

Re: checking if a list is empty

2011-05-15 Thread Terry Reedy
On 5/15/2011 5:36 PM, Terry Reedy wrote: On 5/15/2011 1:33 PM, rusi wrote: Dijkstra's writings I alluded to, at http://www.cs.utexas.edu/users/EWD/transcriptions/EWD10xx/EWD1070.html "Acquiring that familiarity requires what in these financial times is known as "intellectual investment"; y

Re: turn monitor off and on

2011-05-15 Thread harrismh777
Gregory Ewing wrote: I'm not so sure about that. If the monitor is an LCD and isn't doing anything to reduce its own power usage, then the backlight is still running and using just as much power, whether the screen is black or not. Depends on dpmi. Some monitors turn off the backlight, and som

Re: problem with GKT module?

2011-05-15 Thread harrismh777
Alister Ware wrote: I have a simple call back defined for a radio button widget when I use widget.name in linux I get a value of None, windows returns the widget name as I would expect. First, not familiar with your issue... ... but might be able to help you think through it... I am assum

Re: Get the IP address of WIFI interface

2011-05-15 Thread MrJean1
Perhaps, this recipe works for your case: It does parse ifconfig and ipconfig, if found. /Jean On May 15, 2:14 pm, Andrew Berg wrote: > On 2011.05.15 06:12 AM, Tim Golden wrote:> ... and for Windows: > > > > > import wmi > > > for nic in wmi.WM

Re: checking if a list is empty

2011-05-15 Thread harrismh777
rusi wrote: But on further examination (with Leibniz law above) Dijkstra's 2<3 = True will work consistently in all contexts but [1,2,3] = True will work sometimes and fail sometimes. It would have to be written 2<3 == True; [1,2,3] == True; otherwise, ... +1 QOTW -- http://mail.python.org/

Re: Trying to understand html.parser.HTMLParser

2011-05-15 Thread David Robinow
On Sun, May 15, 2011 at 4:45 PM, Andrew Berg wrote: > I'm trying to understand why HMTLParser.feed() isn't returning the whole > page. My test script is this: > > import urllib.request > import html.parser > class MyHTMLParser(html.parser.HTMLParser): >    def handle_starttag(self, tag, attrs): >

Re: Question about available python lib for a task

2011-05-15 Thread Tim Roberts
cesium5...@yahoo.ca wrote: > >I would like to build a database of all the MS-Excel file on a LAN. I >would like to get the files metadata : filename, summary, location, >size, etc. > >Is there a dedicated python lib for the task? No. The file name, location, and size are all completely generic.

Re: dict: retrieve the original key by key

2011-05-15 Thread Ian Kelly
On Sun, May 15, 2011 at 4:18 AM, Steven D'Aprano wrote: > On Sun, 15 May 2011 11:11:41 +0200, Christoph Groth wrote: > >> I would like to avoid having _multiple_ objects which are equal (a == b) >> but not the same (a is not b).  This would save a lot of memory. > > Based on the idea of interning,

MySQLdb SEC_TO_TIME function returns datetime.timedelta class

2011-05-15 Thread Jorge Romero
Hi Pythonists, I'm retrieving some time data from a MySQL database using Python's MySQLdb library. Here's the situation, I got a time field on MySQL given in seconds, I need it on HH:MM:SS format, so I'm SELECTING that field with SEC_TO_TIME function, something like this: query = "SELECT SEC_TO_T

Re: checking if a list is empty

2011-05-15 Thread Steven D'Aprano
On Sun, 15 May 2011 10:33:38 -0700, rusi wrote: > On May 15, 10:07 am, Steven D'Aprano +comp.lang.pyt...@pearwood.info> wrote: >> >> I'm afraid I don't understand what you mean. Can you explain please, >> what properties of "first class booleans" do you think are missing from >> Python? [snip]

Re: turn monitor off and on

2011-05-15 Thread Gregory Ewing
Terry Reedy wrote: My monitor then displays 'No signal detected' in a box and puts itself into a low-power state awaiting a signal. Even if the monitor does not do that, a black screen should use less power. I'm not so sure about that. If the monitor is an LCD and isn't doing anything to redu

Re: Get the IP address of WIFI interface

2011-05-15 Thread Jun Hu
On Sun, May 15, 2011 at 2:14 PM, Andrew Berg wrote: > > One thing I found out about Win32_NetworkAdapterConfiguration is that it > only contains /current/ information and not the stored info that it uses > when making an initial connection (you can see and edit this info in the > Network and Shari

Re: checking if a list is empty

2011-05-15 Thread Terry Reedy
On 5/15/2011 1:33 PM, rusi wrote: On May 15, 10:07 am, Steven D'Aprano wrote: I'm afraid I don't understand what you mean. Can you explain please, what properties of "first class booleans" do you think are missing from Python? Given the usual CS definition of 'first class object', all Python

Re: dict: retrieve the original key by key

2011-05-15 Thread Chris Rebert
On Sun, May 15, 2011 at 1:53 PM, Terry Reedy wrote: > On 5/15/2011 6:46 AM, Christoph Groth wrote: >> But hey, they keys of my dictionary are actually strings, so I can use >> the built-in intern.  Somehow, I have never stumbled accross this >> built-in function so far. > > It was, however, remov

Re: Get the IP address of WIFI interface

2011-05-15 Thread Andrew Berg
On 2011.05.15 06:12 AM, Tim Golden wrote: > ... and for Windows: > > > import wmi > > for nic in wmi.WMI ().Win32_NetworkAdapterConfiguration (IPEnabled=1): >print nic.Caption, nic.IPAddress > > One thing I found out about Win32_NetworkAdapterConfiguration is that it only contains /current/ i

Re: dict: retrieve the original key by key

2011-05-15 Thread Terry Reedy
On 5/15/2011 6:46 AM, Christoph Groth wrote: Steven D'Aprano writes: On Sun, 15 May 2011 11:11:41 +0200, Christoph Groth wrote: I would like to avoid having _multiple_ objects which are equal (a == b) but not the same (a is not b). This would save a lot of memory. Python hashed collection

Trying to understand html.parser.HTMLParser

2011-05-15 Thread Andrew Berg
I'm trying to understand why HMTLParser.feed() isn't returning the whole page. My test script is this: import urllib.request import html.parser class MyHTMLParser(html.parser.HTMLParser): def handle_starttag(self, tag, attrs): if tag == 'a' and attrs: print(tag,'-',attrs

Re: Converting a set into list

2011-05-15 Thread Thomas Rachel
Am 15.05.2011 17:56 schrieb TheSaint: SigmundV wrote: I think the OP wants to find the intersection of two lists. list(set(list1)& set(list2)) is indeed one way to achieve this. [i for i in list1 if i in list2] is another one Exactly. I was confused on that I wasn't able to have a list in re

Re: Get the IP address of WIFI interface

2011-05-15 Thread Tim Golden
On 15/05/2011 20:23, Jun Hu wrote: Thanks for the tip, it is really helpful! however the class of Win32_NetworkAdapterConfiguration doesn't include the interface type (you can NOT tell if it is a wifi interface), so I change the code a bit like following: import wmi wlan_int_id=None for nic in

Re: Recursion or iteration (was Fibonacci series recursion error)

2011-05-15 Thread Mark Dickinson
On May 15, 8:20 pm, Mark Dickinson wrote: > On May 15, 4:32 am, rusi wrote: > > > On May 15, 2:19 am, Ian Kelly wrote: > > > Yup, linear.  Assuming you optimize the even case so that it doesn't > > > actually call fib(n//2) twice, the call tree can be approximated as a > > > balanced binary tree

Re: Recursion or iteration (was Fibonacci series recursion error)

2011-05-15 Thread Mark Dickinson
On May 15, 4:32 am, rusi wrote: > On May 15, 2:19 am, Ian Kelly wrote: > > Yup, linear.  Assuming you optimize the even case so that it doesn't > > actually call fib(n//2) twice, the call tree can be approximated as a > > balanced binary tree with height log(n).  The total number of nodes in > >

Re: Get the IP address of WIFI interface

2011-05-15 Thread Jun Hu
Thanks for the tip, it is really helpful! however the class of Win32_NetworkAdapterConfiguration doesn't include the interface type (you can NOT tell if it is a wifi interface), so I change the code a bit like following: import wmi wlan_int_id=None for nic in wmi.WMI().Win32_NetworkAdapter():

Re: checking if a list is empty

2011-05-15 Thread rusi
On May 15, 10:07 am, Steven D'Aprano wrote: > > I'm afraid I don't understand what you mean. Can you explain please, what > properties of "first class booleans" do you think are missing from Python? Dijkstra's writings I alluded to, take a logic/math line to this. Let me try to rephrase Dijkstr

Re: Converting a set into list

2011-05-15 Thread Roy Smith
In article <34fc571c-f382-405d-94b1-0a673da5f...@t16g2000vbi.googlegroups.com>, SigmundV wrote: > I think the OP wants to find the intersection of two lists. > list(set(list1) & set(list2)) is indeed one way to achieve this. [i > for i in list1 if i in list2] is another one. Both ways work, bu

Re: connect SIGINT to custom interrupt handler

2011-05-15 Thread Christoph Scheingraber
On 2011-05-15, Thomas 'PointedEars' Lahn wrote: > > Obviously. `signal' refers to an `int' object, probably by something like > > signal = 42 > > before. E.g. `print' or a debugger will tell you, as you have not showed > the relevant parts of the code. The problem is that I am running someon

Re: Converting a set into list

2011-05-15 Thread TheSaint
Steven D'Aprano wrote: s = set() s.add(42) s.add(42) s.add(42) print s > set([42]) Good to know. I'll remember it -- goto /dev/null -- http://mail.python.org/mailman/listinfo/python-list

Re: Converting a set into list

2011-05-15 Thread Steven D'Aprano
On Mon, 16 May 2011 00:05:44 +0800, TheSaint wrote: > Chris Torek wrote: > >> >>> x = ['three', 'one', 'four', 'one', 'five'] x >> ['three', 'one', 'four', 'one', 'five'] >> >>> list(set(x)) >> ['four', 'five', 'three', 'one'] > > Why one *"one"* has purged out? > Removing double occurences in a

Re: Python enabled gdb on Windows and relocation

2011-05-15 Thread Ruben Van Boxem
2011/5/15 Ruben Van Boxem : > 2011/5/15 Ruben Van Boxem : >> 2011/5/14 Doug Evans : >>> On Sat, May 14, 2011 at 2:09 AM, Ruben Van Boxem >>> wrote: 2011/5/14 Doug Evans : > On Thu, May 12, 2011 at 9:19 AM, Ruben Van Boxem > wrote: >> (now in plain-text as required by gdb mailing

Re: Converting a set into list

2011-05-15 Thread TheSaint
Chris Torek wrote: > >>> x = ['three', 'one', 'four', 'one', 'five'] > >>> x > ['three', 'one', 'four', 'one', 'five'] > >>> list(set(x)) > ['four', 'five', 'three', 'one'] Why one *"one"* has purged out? Removing double occurences in a list? -- goto /dev/null -- http://mail.python.org/mailman/

Re: Converting a set into list

2011-05-15 Thread TheSaint
SigmundV wrote: > I think the OP wants to find the intersection of two lists. > list(set(list1) & set(list2)) is indeed one way to achieve this. [i > for i in list1 if i in list2] is another one Exactly. I was confused on that I wasn't able to have a list in return. The set intersection is the sm

Re: connect SIGINT to custom interrupt handler

2011-05-15 Thread Thomas 'PointedEars' Lahn
Christoph Scheingraber wrote: > I now have signal.siginterrupt(signal.SIGINT, False) in the line > below signal.signal(signal.SIGINT, interrupt_handler) > > Unfortunately, pressing ^c still results in the same interrupt error. I > also tried putting signal.siginterrupt into the interrupt_handler

Re: connect SIGINT to custom interrupt handler

2011-05-15 Thread Chris Angelico
On Mon, May 16, 2011 at 12:32 AM, Christoph Scheingraber wrote: > I now have signal.siginterrupt(signal.SIGINT, False) in the line > below signal.signal(signal.SIGINT, interrupt_handler) > > Unfortunately, pressing ^c still results in the same interrupt error. I > also tried putting signal.siginte

Re: connect SIGINT to custom interrupt handler

2011-05-15 Thread Miki Tebeka
Greetings, > I am trying to connect SIGINT (^c) to a custom interrupt handler like > this (no threading, just straightforward): Why not just catch KeyboardInterrupt? All the best, -- Miki -- http://mail.python.org/mailman/listinfo/python-list

Re: connect SIGINT to custom interrupt handler

2011-05-15 Thread Christoph Scheingraber
I now have signal.siginterrupt(signal.SIGINT, False) in the line below signal.signal(signal.SIGINT, interrupt_handler) Unfortunately, pressing ^c still results in the same interrupt error. I also tried putting signal.siginterrupt into the interrupt_handler function, which gave an interesting resul

SEE KAREENA KAPOOR BOLLYWOOD HOT ACTRESS BOOBS PRESSED IN SHOPPING MALL

2011-05-15 Thread charmi s
SEE KAREENA KAPOOR BOLLYWOOD HOT ACTRESS BOOBS PRESSED IN SHOPPING MALL At http://hollypops.Co.CC Due to GOOGLE security risks, i have hidden the videos in an image. in that website on Right side below search box click on image and watch videos in all angles. -- http://mail.python.org/mailman/li

Re: Python enabled gdb on Windows and relocation

2011-05-15 Thread Ruben Van Boxem
2011/5/15 Ruben Van Boxem : > 2011/5/14 Doug Evans : >> On Sat, May 14, 2011 at 2:09 AM, Ruben Van Boxem >> wrote: >>> 2011/5/14 Doug Evans : On Thu, May 12, 2011 at 9:19 AM, Ruben Van Boxem wrote: > (now in plain-text as required by gdb mailing list) > > Hi, > > I a

Re: connect SIGINT to custom interrupt handler

2011-05-15 Thread Nobody
On Sun, 15 May 2011 09:44:04 +, Christoph Scheingraber wrote: > signal.signal(signal.SIGINT, interrupt_handler) > This worked fine in some rare lucky cases, but most of the times, the > module I am using (my university's seismology project) catches the SIGINT > and quits: > > select.error: (

Re: Python enabled gdb on Windows and relocation

2011-05-15 Thread Ruben Van Boxem
2011/5/14 Doug Evans : > On Sat, May 14, 2011 at 2:09 AM, Ruben Van Boxem > wrote: >> 2011/5/14 Doug Evans : >>> On Thu, May 12, 2011 at 9:19 AM, Ruben Van Boxem >>> wrote: (now in plain-text as required by gdb mailing list) Hi, I am currently trying to integrate Python s

Re: Converting a set into list

2011-05-15 Thread SigmundV
I'm sorry I top posted. I'll remember not to top post next time. Sigmund -- http://mail.python.org/mailman/listinfo/python-list

Re: Converting a set into list

2011-05-15 Thread SigmundV
I think the OP wants to find the intersection of two lists. list(set(list1) & set(list2)) is indeed one way to achieve this. [i for i in list1 if i in list2] is another one. Sigmund On May 15, 4:11 am, Chris Torek wrote: > In article <871v00j2bh@benfinney.id.au> > Ben Finney   wrote: > > >As

Re: problem with GKT module?

2011-05-15 Thread Alister Ware
On Fri, 13 May 2011 13:13:00 +, alister ware wrote: > I am using gtk.builder with a glade generated GUI > > I have a simple call back defined for a radio button widget when I use > widget.name in linux I get a value of None, windows returns the widget > name as I would expect. > > is this a

Re: Get the IP address of WIFI interface

2011-05-15 Thread Tim Golden
On 15/05/2011 12:04 PM, Neal Becker wrote: Far.Runner wrote: Hi python experts: There are two network interfaces on my laptop: one is 100M Ethernet interface, the other is wifi interface, both are connected and has an ip address. The question is: How to get the ip address of the wifi interface

Re: Get the IP address of WIFI interface

2011-05-15 Thread Neal Becker
Far.Runner wrote: > Hi python experts: > There are two network interfaces on my laptop: one is 100M Ethernet > interface, the other is wifi interface, both are connected and has an ip > address. > The question is: How to get the ip address of the wifi interface in a python > script without parsing

Re: Python 3.2 Vectors.py module

2011-05-15 Thread Algis Kabaila
On Sunday 15 May 2011 19:44:29 Daniel Kluev wrote: > On Sun, May 15, 2011 at 8:15 PM, Algis Kabaila wrote: > > Hi All, > > > > I would really appreciate any comments and suggestions for > > the Vectors.py module, which can be downloaded from > > - If you intend to provide it as general-purpose

Re: dict: retrieve the original key by key

2011-05-15 Thread Christoph Groth
Steven D'Aprano writes: > On Sun, 15 May 2011 11:11:41 +0200, Christoph Groth wrote: > >> I would like to avoid having _multiple_ objects which are equal (a == >> b) but not the same (a is not b). This would save a lot of memory. > > Based on the idea of interning, which is used for Python strin

Re: dict: retrieve the original key by key

2011-05-15 Thread Steven D'Aprano
On Sun, 15 May 2011 11:11:41 +0200, Christoph Groth wrote: > I would like to avoid having _multiple_ objects which are equal (a == b) > but not the same (a is not b). This would save a lot of memory. Based on the idea of interning, which is used for Python strings: cache = {} def my_intern(obj)

Re: threads with gtk gui problem

2011-05-15 Thread Daniel Kluev
You can also use multiprocessing module instead of threads. Use pipe and gobject.idle_add(somefunc) to process data from other thread. -- With best regards, Daniel Kluev -- http://mail.python.org/mailman/listinfo/python-list

connect SIGINT to custom interrupt handler

2011-05-15 Thread Christoph Scheingraber
Hi, I am trying to connect SIGINT (^c) to a custom interrupt handler like this (no threading, just straightforward): if __name__ == "__main__": quit = False def interrupt_handler(signal, frame): global quit if not quit: print "blabla, i'll finish my task and quit kind of messag

Re: Python 3.2 Vectors.py module

2011-05-15 Thread Daniel Kluev
On Sun, May 15, 2011 at 8:15 PM, Algis Kabaila wrote: > Hi All, > > I would really appreciate any comments and suggestions for the Vectors.py > module, which can be downloaded from - If you intend to provide it as general-purpose vector module for other people to use, it would be better if you pa

ANN: Fathom 0.3.0

2011-05-15 Thread Filip Gruszczyński
Hi, I have released version 0.2.0 of fathom, python3 package for database inspection. Fathom supports retrieving database schema from Sqlite3, PostgreSQL, MySQL and Oracle. This is still very early version and I am experimenting with different approaches. As always I would be very thankful for an

Python 3.2 Vectors.py module

2011-05-15 Thread Algis Kabaila
Hi All, I would really appreciate any comments and suggestions for the Vectors.py module, which can be downloaded from http://akabaila.pcug.org.au/linalg/vectors.tar.gz The tar ball is only about 4 KiB, but I gather that this mailing list does not tolerate attachments. The module is designed

Re: dict: retrieve the original key by key

2011-05-15 Thread Christoph Groth
Chris Rebert writes: > On Sun, May 15, 2011 at 1:28 AM, Christoph Groth wrote: >> I use a huge python dictionary where the values are lists of that >> dictionary's keys (yes, a graph).  Each key is thus referenced >> several times. >> >> As the keys are rather large objects, I would like to save

recvall()

2011-05-15 Thread Navkirat Singh
Hi All, I am trying to program an HTTP webserver, I am a little confused about the best way to program a recvall function. There are a couple of ways to do this? But performance wise which one is better? a) recvall using a timeout? b) recvall using a condition that nothing was received? c) recval

Re: Python drawing library?

2011-05-15 Thread Wojtek Mamrak
Yes, it is possible with use of PyQt. 2011/5/15 Rafael Durán Castañeda : > On 15/05/11 01:01, OKB (not okblacke) wrote: >> >>        Is there any Python library for interactive drawing?  I've done >> some googling but most searches for "drawing" lead me to libraries for >> programmatic creation of

Re: dict: retrieve the original key by key

2011-05-15 Thread Chris Rebert
On Sun, May 15, 2011 at 1:28 AM, Christoph Groth wrote: > Dear python experts, > > I use a huge python dictionary where the values are lists of that > dictionary's keys (yes, a graph).  Each key is thus referenced several > times. > > As the keys are rather large objects, I would like to save memo

Re: Python drawing library?

2011-05-15 Thread Rafael Durán Castañeda
On 15/05/11 01:01, OKB (not okblacke) wrote: Is there any Python library for interactive drawing? I've done some googling but most searches for "drawing" lead me to libraries for programmatic creation of shapes on some GUI canvas. I'm looking for GUI widgets that allow the user to draw

dict: retrieve the original key by key

2011-05-15 Thread Christoph Groth
Dear python experts, I use a huge python dictionary where the values are lists of that dictionary's keys (yes, a graph). Each key is thus referenced several times. As the keys are rather large objects, I would like to save memory by re-using key objects wherever possible, instead of having sever