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

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

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 c...@falma.de 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

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 rafadurancastan...@gmail.com: 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

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)

Re: dict: retrieve the original key by key

2011-05-15 Thread Christoph Groth
Chris Rebert c...@rebertia.com writes: On Sun, May 15, 2011 at 1:28 AM, Christoph Groth c...@falma.de 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,

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

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

Re: Python 3.2 Vectors.py module

2011-05-15 Thread Daniel Kluev
On Sun, May 15, 2011 at 8:15 PM, Algis Kabaila akaba...@pcug.org.au 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

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 message

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

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: dict: retrieve the original key by key

2011-05-15 Thread Christoph Groth
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info 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,

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 akaba...@pcug.org.au 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

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 the

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: 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 bug?

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 nos...@torek.net wrote: In article 871v00j2bh@benfinney.id.au Ben Finney  

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: Python enabled gdb on Windows and relocation

2011-05-15 Thread Ruben Van Boxem
2011/5/14 Doug Evans d...@google.com: On Sat, May 14, 2011 at 2:09 AM, Ruben Van Boxem vanboxem.ru...@gmail.com wrote: 2011/5/14 Doug Evans d...@google.com: On Thu, May 12, 2011 at 9:19 AM, Ruben Van Boxem vanboxem.ru...@gmail.com wrote: (now in plain-text as required by gdb mailing list)

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: (4,

Re: Python enabled gdb on Windows and relocation

2011-05-15 Thread Ruben Van Boxem
2011/5/15 Ruben Van Boxem vanboxem.ru...@gmail.com: 2011/5/14 Doug Evans d...@google.com: On Sat, May 14, 2011 at 2:09 AM, Ruben Van Boxem vanboxem.ru...@gmail.com wrote: 2011/5/14 Doug Evans d...@google.com: On Thu, May 12, 2011 at 9:19 AM, Ruben Van Boxem vanboxem.ru...@gmail.com wrote:

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. --

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

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 Chris Angelico
On Mon, May 16, 2011 at 12:32 AM, Christoph Scheingraber ch...@spam.org 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

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: 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

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 --

Re: Python enabled gdb on Windows and relocation

2011-05-15 Thread Ruben Van Boxem
2011/5/15 Ruben Van Boxem vanboxem.ru...@gmail.com: 2011/5/15 Ruben Van Boxem vanboxem.ru...@gmail.com: 2011/5/14 Doug Evans d...@google.com: On Sat, May 14, 2011 at 2:09 AM, Ruben Van Boxem vanboxem.ru...@gmail.com wrote: 2011/5/14 Doug Evans d...@google.com: On Thu, May 12, 2011 at 9:19

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 list? Break the

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: connect SIGINT to custom interrupt handler

2011-05-15 Thread Christoph Scheingraber
On 2011-05-15, Thomas 'PointedEars' Lahn pointede...@web.de 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

Re: Converting a set into list

2011-05-15 Thread Roy Smith
In article 34fc571c-f382-405d-94b1-0a673da5f...@t16g2000vbi.googlegroups.com, SigmundV sigmu...@gmail.com 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

Re: checking if a list is empty

2011-05-15 Thread rusi
On May 15, 10:07 am, Steven D'Aprano steve +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? Dijkstra's writings I alluded to, take a logic/math line to

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: Recursion or iteration (was Fibonacci series recursion error)

2011-05-15 Thread Mark Dickinson
On May 15, 4:32 am, rusi rustompm...@gmail.com wrote: On May 15, 2:19 am, Ian Kelly ian.g.ke...@gmail.com 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

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

2011-05-15 Thread Mark Dickinson
On May 15, 8:20 pm, Mark Dickinson dicki...@gmail.com wrote: On May 15, 4:32 am, rusi rustompm...@gmail.com wrote: On May 15, 2:19 am, Ian Kelly ian.g.ke...@gmail.com wrote: Yup, linear.  Assuming you optimize the even case so that it doesn't actually call fib(n//2) twice, the call tree

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: 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

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:

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'Apranosteve+comp.lang.pyt...@pearwood.info 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

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: code import wmi for nic in wmi.WMI ().Win32_NetworkAdapterConfiguration (IPEnabled=1): print nic.Caption, nic.IPAddress /code One thing I found out about Win32_NetworkAdapterConfiguration is that it only contains /current/

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 tjre...@udel.edu wrote: On 5/15/2011 6:46 AM, Christoph Groth wrote: snip 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,

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'Apranosteve +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? Given the usual CS definition

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 bahamutzero8...@gmail.comwrote: 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

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

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 steve +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] I'm

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

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 steve+comp.lang.pyt...@pearwood.info 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.

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. You

Re: Trying to understand html.parser.HTMLParser

2011-05-15 Thread David Robinow
On Sun, May 15, 2011 at 4:45 PM, Andrew Berg bahamutzero8...@gmail.com 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

Re: checking if a list is empty

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

Re: Get the IP address of WIFI interface

2011-05-15 Thread MrJean1
Perhaps, this recipe works for your case: http://code.activestate.com/recipes/577191 It does parse ifconfig and ipconfig, if found. /Jean On May 15, 2:14 pm, Andrew Berg bahamutzero8...@gmail.com wrote: On 2011.05.15 06:12 AM, Tim Golden wrote: ... and for Windows: code import wmi

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

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

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; you

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 --

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 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 ros...@gmail.com 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

Re: obviscating python code for distribution

2011-05-15 Thread Daniel Kluev
On Mon, May 16, 2011 at 1:04 PM, Littlefield, Tyler ty...@tysdomain.com 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

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. --

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 setset solution, in contrary, might require one loop while transforming to a set and another one for the operation. python -m timeit

Re: obviscating python code for distribution

2011-05-15 Thread James Mills
On Mon, May 16, 2011 at 12:21 PM, Daniel Kluev dan.kl...@gmail.com 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

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 Ben Finney
Littlefield, Tyler ty...@tysdomain.com 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

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,

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

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 jorgeromero...@gmail.com 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

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

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

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: 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 ros...@gmail.com wrote: On Mon, May 16, 2011 at 10:42 AM, Jorge Romero jorgeromero...@gmail.com 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

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 gnarlodi...@gmail.com 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

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 gnarlodi...@gmail.com 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

Re: obviscating python code for distribution

2011-05-15 Thread Ben Finney
Littlefield, Tyler ty...@tysdomain.com 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

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

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 But all I get

Re: obviscating python code for distribution

2011-05-15 Thread Chris Angelico
On Mon, May 16, 2011 at 2:03 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info 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

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 gnarlodi...@gmail.com 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

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 --

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 gnarlodi...@gmail.com 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

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 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: 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

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

[issue11802] filecmp.cmp needs a documented way to clear cache

2011-05-15 Thread Georg Brandl
Georg Brandl ge...@python.org added the comment: -1 on backporting. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11802 ___ ___

[issue6498] Py_Main() does not return on SystemExit

2011-05-15 Thread Roundup Robot
Roundup Robot devnull@devnull added the comment: New changeset 0311f62714f7 by Georg Brandl in branch '3.1': Closes #6498: fix several misspellings of SystemExit as SystemError. http://hg.python.org/cpython/rev/0311f62714f7 New changeset 7089afd69a1a by Georg Brandl in branch '3.2': Merge #6498

[issue1746656] IPv6 Interface naming/indexing functions

2011-05-15 Thread Roundup Robot
Roundup Robot devnull@devnull added the comment: New changeset c2515cb23d9b by Gregory P. Smith in branch 'default': Issue #1746656: Add if_nameindex, if_nametoindex, if_indextoname http://hg.python.org/cpython/rev/c2515cb23d9b -- nosy: +python-dev

[issue1746656] IPv6 Interface naming/indexing functions

2011-05-15 Thread Gregory P. Smith
Gregory P. Smith g...@krypto.org added the comment: I added these with conditional compilation via autoconf for use on posix systems. These methods are not IPv6 specific. Anyone who wants to see them supported on windows will need to add whatever conditional compilation magic is required to

[issue10756] Error in atexit._run_exitfuncs [...] Exception expected for value, str found

2011-05-15 Thread kai zhu
kai zhu kai...@ugcs.caltech.edu added the comment: should this bug b closed? it seems fixed in python3.2 for me. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10756 ___

[issue12079] decimal.py: TypeError precedence in fma()

2011-05-15 Thread Stefan Krah
New submission from Stefan Krah stefan-use...@bytereef.org: Hi, I think that TypeError should take precedence over InvalidOperation in these two cases: Decimal('Infinity').fma(Decimal('0'), (3.91224318126786e+19+0j)) Traceback (most recent call last): File stdin, line 1, in module File

[issue10756] Error in atexit._run_exitfuncs [...] Exception expected for value, str found

2011-05-15 Thread Georg Brandl
Georg Brandl ge...@python.org added the comment: Well, Victor still wanted to backport it. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10756 ___

[issue1746656] IPv6 Interface naming/indexing functions

2011-05-15 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: New changeset c2515cb23d9b by Gregory P. Smith in branch 'default': Issue #1746656: Add if_nameindex, if_nametoindex, if_indextoname The _socket module doesn't compile on OpenIndiana anymore:

[issue12079] decimal.py: TypeError precedence in fma()

2011-05-15 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: Yes, I agree. Do you have a patch? I guess the only mildly tricky part here is making sure that the patch doesn't cause fma(2, 3, snan) (for example) to raise. -- ___ Python tracker

[issue12079] decimal.py: TypeError precedence in fma()

2011-05-15 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: cause fma(2, 3, snan) ... Gah! That was nonsense. Please ignore. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12079 ___

[issue1746656] IPv6 Interface naming/indexing functions

2011-05-15 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: The _socket module doesn't compile on OpenIndiana anymore Same problem of FreeBSD 8.2: http://www.python.org/dev/buildbot/all/builders/AMD64%20FreeBSD%208.2%203.x/builds/291/steps/test/logs/stdio --

[issue12075] python3.2 memory leak when setting integer key in dictionary

2011-05-15 Thread kai zhu
kai zhu kai...@ugcs.caltech.edu added the comment: explicit gc.collect() doesn't seem to fix the leak in my application. my current fix is to not re-instantiate the class attribute (which cost ~7mb) during reload instead reference one created earlier. i haven't pinpointed y, but i suspect its

[issue12060] Python doesn't support real time signals

2011-05-15 Thread Roundup Robot
Roundup Robot devnull@devnull added the comment: New changeset 945ca78c38b1 by Victor Stinner in branch '3.1': Issue #12060: Use sig_atomic_t type and volatile keyword in the signal module. http://hg.python.org/cpython/rev/945ca78c38b1 New changeset b74999f561ca by Victor Stinner in branch

[issue12080] decimal.py: performance in _power_exact

2011-05-15 Thread Stefan Krah
New submission from Stefan Krah stefan-use...@bytereef.org: I found another performance issue in _power_exact: Decimal(4) ** Decimal(-1.2e-9) ^CTraceback (most recent call last): File stdin, line 1, in module File /home/stefan/pydev/cpython/Lib/decimal.py, line 2343, in __pow__

  1   2   >