Re: python module development workflow

2012-04-12 Thread rusi
On Apr 11, 8:38 pm, Peng Yu wrote: > On Apr 11, 10:25 am, John Gordon wrote: > > > In <2900f481-fbe9-4da3-a7ca-5485d1ceb...@m13g2000yqc.googlegroups.com> Peng > > Yu writes: > > > > It is confusing to me what the best workflow is for python module > > > development. There is setup.py, egg. Also

Re: Mouse LED Control in Python

2012-04-12 Thread Shaunda
How can I make a battery powered http://www.ledstrips8.com/led-light-bars-c-38.html led strip 12v with 3 way switches? My goal is to make a long line of grouped LEDs that is battery powered and can be turned on or off from 2 different locations. I'm trying to make a lighting system that doesn't

Re: remainder of dividing by zero

2012-04-12 Thread MRAB
On 12/04/2012 23:34, Ethan Furman wrote: Okay, so I haven't asked a stupid question in a long time and I'm suffering withdrawal symptoms... ;) 5 % 0 = ? It seems to me that the answer should be 5: no matter how many times we add 0 to itself, the remainder of the intermediate step will be 5. Is

Re: remainder of dividing by zero

2012-04-12 Thread Terry Reedy
On 4/12/2012 6:34 PM, Ethan Furman wrote: Okay, so I haven't asked a stupid question in a long time and I'm suffering withdrawal symptoms... ;) 5 % 0 = ? It seems to me that the answer should be 5: no matter how many times we add 0 to itself, the remainder of the intermediate step will be 5. I

Re: functions which take functions

2012-04-12 Thread Kiuhnm
On 4/12/2012 19:29, Jan Kuiken wrote: On 4/9/12 20:57 , Kiuhnm wrote: Do you have some real or realistic (but easy and self-contained) examples when you had to define a (multi-statement) function and pass it to another function? I don't use it daily but the first argument of list.sort, i.e. t

remainder of dividing by zero

2012-04-12 Thread Ethan Furman
Okay, so I haven't asked a stupid question in a long time and I'm suffering withdrawal symptoms... ;) 5 % 0 = ? It seems to me that the answer should be 5: no matter how many times we add 0 to itself, the remainder of the intermediate step will be 5. Is there a postulate or by definition ans

Re: is this foolish?

2012-04-12 Thread Cameron Simpson
On 12Apr2012 10:44, gene heskett wrote: | On Thursday, April 12, 2012 10:40:47 AM Tim Golden did opine: | > On 12/04/2012 10:35, Cameron Simpson wrote: | > > I've found myself using a Python gotcha as a feature. | > | Tim: your setup of using the CC: line for every thing with a blank To: | line

Re: GNTP not connecting

2012-04-12 Thread milosh zorica
thanks On Thu, Apr 12, 2012 at 7:30 PM, Chris Angelico wrote: > On Fri, Apr 13, 2012 at 7:44 AM, milosh zorica wrote: >> yes but what? >> >> everything else works cool and i can connect via socket from python >> >> On Thu, Apr 12, 2012 at 6:38 PM, Chris Angelico wrote: >>> On Fri, Apr 13, 2012

Re: GNTP not connecting

2012-04-12 Thread Chris Angelico
On Fri, Apr 13, 2012 at 7:44 AM, milosh zorica wrote: > yes but what? > > everything else works cool and i can connect via socket from python > > On Thu, Apr 12, 2012 at 6:38 PM, Chris Angelico wrote: >> On Fri, Apr 13, 2012 at 7:32 AM, milosh zorica >> wrote: >>>    s.connect((self.hostname, s

Re: Deep merge two dicts?

2012-04-12 Thread Kiuhnm
On 4/12/2012 19:59, John Nagle wrote: On 4/12/2012 10:41 AM, Roy Smith wrote: Is there a simple way to deep merge two dicts? I'm looking for Perl's Hash::Merge (http://search.cpan.org/~dmuey/Hash-Merge-0.12/Merge.pm) in Python. def dmerge(a, b) : for k in a : v = a[k] if isi

Re: GNTP not connecting

2012-04-12 Thread Chris Angelico
On Fri, Apr 13, 2012 at 7:32 AM, milosh zorica wrote: >    s.connect((self.hostname, self.port)) > socket.error: [Errno 61] Connection refused This is saying that the computer at that hostname is running, but no program is listening on that port. Maybe you have the host/port wrong, or maybe somet

GNTP not connecting

2012-04-12 Thread milosh zorica
hey folks seems GNTP doesn't work for me. the growl app itself works cool import gntp.notifier gntp.notifier.mini("message") - Traceback (most recent call last): File "", line 1, in File "/Library/Frameworks/Python.framework/Versions/2.7/lib/pytho

Re: Why does this hang sometimes?

2012-04-12 Thread Jesse Jaggars
Possibly. I wonder what the difference(s) is(are)? On Sat, Apr 7, 2012 at 5:54 PM, Jason Friedman wrote: >> I am just playing around with threading and subprocess and found that >> the following program will hang up and never terminate every now and >> again. >> >> import threading >> import subp

Re: older woman and young guy

2012-04-12 Thread jimmy970
http://porn-extreme.2304310.n4.nabble.com/ http://porn-extreme.2304310.n4.nabble.com/ -- View this message in context: http://python.6.n6.nabble.com/AMPUTEE-INCEST-MIDGET-2012-tp4708963p4864079.html Sent from the Python - python-list mailing list archive at Nabble.com. -- http://mail.python.org

Re: Sockets accept() in child processes

2012-04-12 Thread Dan Stromberg
On Thu, Apr 12, 2012 at 10:48 AM, Merwin wrote: > Le 12/04/2012 19:10, Dan Stromberg a écrit : > > >> I wonder if this'll do what you need: >> https://trac.calendarserver.**org/browser/CalendarServer/** >> trunk/twext/python/sendfd.py

Re: multiprocessing and Array problems

2012-04-12 Thread MRAB
On 12/04/2012 19:30, Al Niessner wrote: Here is an update. def subproc (i): print ("From subprocess " + str(i)) print (b[:]) return if __name__ == "__main__": nproc = 3 print ("\nBuilding the array for the second computation.") b = multiprocessing.Array (ctypes.c_

Re: Error in MD5 checksums of the 2.7.3 release page.

2012-04-12 Thread Terry Reedy
On 4/12/2012 6:11 AM, Jérémy Bethmont wrote: There is an error in the MD5 checksums section of the following page: http://python.org/download/releases/2.7.3/ Python-3.1.5.tgz, Python-3.1.5.tar.bz2 and Python-3.1.5.tar.xz are listed instead of: Python-2.7.3.tgz, Python-2.7.3.tar.bz2 and Pyt

Re: Deep merge two dicts?

2012-04-12 Thread Ian Kelly
On Thu, Apr 12, 2012 at 11:59 AM, John Nagle wrote: > On 4/12/2012 10:41 AM, Roy Smith wrote: >> >> Is there a simple way to deep merge two dicts?  I'm looking for Perl's >> Hash::Merge (http://search.cpan.org/~dmuey/Hash-Merge-0.12/Merge.pm) >> in Python. > > > def dmerge(a, b) : >   for k in a :

Re: multiprocessing and Array problems

2012-04-12 Thread Al Niessner
Here is an update. def subproc (i): print ("From subprocess " + str(i)) print (b[:]) return if __name__ == "__main__": nproc = 3 print ("\nBuilding the array for the second computation.") b = multiprocessing.Array (ctypes.c_double, nproc*nproc, lock=False) print ("\n

multiprocessing and Array problems

2012-04-12 Thread Al Niessner
I am not subscribed to these lists but I do check them occasionally and will check them more frequently looking for a response. I am getting a pickling error that I do not understand. It seems the shared arrays that I create cannot be pickled. Makes the multiprocessing.Array fairly useless if it

Re: Deep merge two dicts?

2012-04-12 Thread John Nagle
On 4/12/2012 10:41 AM, Roy Smith wrote: Is there a simple way to deep merge two dicts? I'm looking for Perl's Hash::Merge (http://search.cpan.org/~dmuey/Hash-Merge-0.12/Merge.pm) in Python. def dmerge(a, b) : for k in a : v = a[k] if isinstance(v, dict) and k in b:

Re: Sockets accept() in child processes

2012-04-12 Thread Merwin
Le 12/04/2012 19:10, Dan Stromberg a écrit : I wonder if this'll do what you need: https://trac.calendarserver.org/browser/CalendarServer/trunk/twext/python/sendfd.py The problem is that this is Linux-only solution, and I would like to keep a multi-platform compatibility. There are other wa

Deep merge two dicts?

2012-04-12 Thread Roy Smith
Is there a simple way to deep merge two dicts? I'm looking for Perl's Hash::Merge (http://search.cpan.org/~dmuey/Hash-Merge-0.12/Merge.pm) in Python. -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem connecting to SMTP/IMAP server using SSL

2012-04-12 Thread Dan Stromberg
Maybe it's a matter of two different protocols, one requiring a VPN, one not. You could perhaps try a sniffer to check that out. Where to place the sniffer could be complicated though. On Fri, Mar 30, 2012 at 10:39 PM, Julien wrote: > Hi, > > I'm able to connect to an Exchange server via SMTP

Re: functions which take functions

2012-04-12 Thread Jan Kuiken
On 4/9/12 20:57 , Kiuhnm wrote: Do you have some real or realistic (but easy and self-contained) examples when you had to define a (multi-statement) function and pass it to another function? I don't use it daily but the first argument of list.sort, i.e. the compare function springs to mind. J

Re: python module development workflow

2012-04-12 Thread John Nagle
On 4/11/2012 1:04 PM, Miki Tebeka wrote: Could any expert suggest an authoritative and complete guide for developing python modules? Thanks! I'd start with http://docs.python.org/distutils/index.html Make sure that python setup.py build python setup.py install works.

Re: Problem connecting to SMTP/IMAP server using SSL

2012-04-12 Thread Dan Stromberg
Are you quite sure that your iPhone isn't using some sort of VPN? On my Android phone, I need a VPN client to access my work mail, but I install it once and forget about it; it doesn't require me to enter my password more than once. On Fri, Mar 30, 2012 at 10:39 PM, Julien wrote: > Hi, > > I'm

Re: Sockets accept() in child processes

2012-04-12 Thread Dan Stromberg
I wonder if this'll do what you need: https://trac.calendarserver.org/browser/CalendarServer/trunk/twext/python/sendfd.py On Thu, Apr 12, 2012 at 2:31 AM, Thibaut DIRLIK wrote: > Hi, > > I'm writing a multiprocess server with Python 3.2 and the multiprocessing > module. Here is my current impleme

Re: Is it possible develop applications in python for android and which IDE could you recommend me (Eclipse, ...)???

2012-04-12 Thread Dan Stromberg
http://code.google.com/p/android-scripting/ However, I've not used it, and I'm told it requires a stub for each new android method exposed to python. I find it a little regrettable that they didn't start frp, jython or pypy for jvm instead of cpython, to avoid all the stubbing. On Thu, Apr 12, 2

Re: Zipping a dictionary whose values are lists

2012-04-12 Thread Dan Sommers
On Thu, 12 Apr 2012 09:28:03 -0700 (PDT) tkp...@gmail.com wrote: > I using Python 3.2 and have a dictionary > >>> d = {0:[1,2], 1:[1,2,3], 2:[1,2,3,4]} > > whose values are lists I would like to zip into a list of tuples. If > I explicitly write: > >>> list(zip([1,2], [1,2,3], [1,2,3,4]) > [(1, 1

Re: Zipping a dictionary whose values are lists

2012-04-12 Thread Peter Otten
tkp...@gmail.com wrote: > I using Python 3.2 and have a dictionary d = {0:[1,2], 1:[1,2,3], 2:[1,2,3,4]} > > whose values are lists I would like to zip into a list of tuples. If I > explicitly write: list(zip([1,2], [1,2,3], [1,2,3,4]) > [(1, 1, 1), (2, 2, 2)] > > I get exactly what I

Re: Zipping a dictionary whose values are lists

2012-04-12 Thread Kiuhnm
On 4/12/2012 18:28, tkp...@gmail.com wrote: I using Python 3.2 and have a dictionary d = {0:[1,2], 1:[1,2,3], 2:[1,2,3,4]} whose values are lists I would like to zip into a list of tuples. If I explicitly write: list(zip([1,2], [1,2,3], [1,2,3,4]) [(1, 1, 1), (2, 2, 2)] I get exactly what

Re: Zipping a dictionary whose values are lists

2012-04-12 Thread Pavel Anossov
zip(*d.values()) On 12 April 2012 20:28, wrote: > I using Python 3.2 and have a dictionary d = {0:[1,2], 1:[1,2,3], 2:[1,2,3,4]} > > whose values are lists I would like to zip into a list of tuples. If I > explicitly write: list(zip([1,2], [1,2,3], [1,2,3,4]) > [(1, 1, 1), (2, 2, 2)]

Zipping a dictionary whose values are lists

2012-04-12 Thread tkpmep
I using Python 3.2 and have a dictionary >>> d = {0:[1,2], 1:[1,2,3], 2:[1,2,3,4]} whose values are lists I would like to zip into a list of tuples. If I explicitly write: >>> list(zip([1,2], [1,2,3], [1,2,3,4]) [(1, 1, 1), (2, 2, 2)] I get exactly what I want. On the other hand, I have tried >

Re: functions which take functions

2012-04-12 Thread Kiuhnm
On 4/12/2012 8:07, Tim Roberts wrote: Kiuhnm wrote: That won't do. A good example is when you pass a function to re.sub, for instance. This is an odd request. All shall be revealed :) I often pass functions to functions in order to simulate a C switch statement, such as in a language tr

Re: functions which take functions

2012-04-12 Thread Kiuhnm
On 4/11/2012 16:01, Antti J Ylikoski wrote: On 9.4.2012 21:57, Kiuhnm wrote: Do you have some real or realistic (but easy and self-contained) examples when you had to define a (multi-statement) function and pass it to another function? Thank you. Kiuhnm A function to numerically integrate ano

Re: is this foolish?

2012-04-12 Thread gene heskett
On Thursday, April 12, 2012 10:40:47 AM Tim Golden did opine: > On 12/04/2012 10:35, Cameron Simpson wrote: > > I've found myself using a Python gotcha as a feature. > Tim: your setup of using the CC: line for every thing with a blank To: line is landing your posts in my spam folder. Do you ha

Re: [Windows] drag-and-drop onto .py file in modern versions?

2012-04-12 Thread Mark Lawrence
On 12/04/2012 08:00, Chris Angelico wrote: On Thu, Apr 12, 2012 at 4:02 PM, Karl Knechtel wrote: Aside: when I double-click a .py file, what determines which Python will run it? Is it a matter of which appears first in the PATH, or do I have to set something else in the registry? Will a shebang

Coping with risk of decision - modeling of scenarios of parameters of the model in python

2012-04-12 Thread John Oksz
Hello, I work with energy planning on municipal level. I have an energy supply deterministic model for municipal customer. Now I want to coping with uncertainty and risk of decision choosing one energy supply option for implementing in real. Some parameters of my deterministic model (energy pric

Re: is this foolish?

2012-04-12 Thread Andrea Crotti
On 04/12/2012 10:35 AM, Cameron Simpson wrote: I've found myself using a Python gotcha as a feature. I've got a budding mail filter program which keeps rule state in a little class instance. Slightly paraphrased: class RuleState(object): def __init__(self, M, maildb_path, maildirs

Re: is this foolish?

2012-04-12 Thread Jean-Michel Pichavant
Cameron Simpson wrote: I've found myself using a Python gotcha as a feature. I've got a budding mail filter program which keeps rule state in a little class instance. Slightly paraphrased: class RuleState(object): def __init__(self, M, maildb_path, maildirs={}): [...]

Re: Problem connecting to SMTP/IMAP server using SSL

2012-04-12 Thread Christian Heimes
Am 12.04.2012 08:56, schrieb Julien Phalip: > Hi Michael, > > Thanks again for your reply. I've tried using SMTP with TLS. And again > it works with the VPN turned on but it still won't work with the VPN > turned off. For some reason I don't understand, it simply won't > instantiate the SMTP/SMTP_

Re: is this foolish?

2012-04-12 Thread Karl Knechtel
On Thu, Apr 12, 2012 at 7:15 AM, Tim Golden wrote: > On 12/04/2012 10:35, Cameron Simpson wrote: > > I've found myself using a Python gotcha as a feature. > > Have a look at Peter Inglesby's lightning talk from a > recent London Python Dojo: > > http://inglesp.github.com/2012/03/24/mutable-defau

Re: is this foolish?

2012-04-12 Thread Tim Golden
On 12/04/2012 10:35, Cameron Simpson wrote: > I've found myself using a Python gotcha as a feature. Have a look at Peter Inglesby's lightning talk from a recent London Python Dojo: http://inglesp.github.com/2012/03/24/mutable-default-arguments.html TJG -- http://mail.python.org/mailman/listin

Error in MD5 checksums of the 2.7.3 release page.

2012-04-12 Thread Jérémy Bethmont
Hello, There is an error in the MD5 checksums section of the following page:     http://python.org/download/releases/2.7.3/ Python-3.1.5.tgz, Python-3.1.5.tar.bz2 and Python-3.1.5.tar.xz are listed instead of: Python-2.7.3.tgz, Python-2.7.3.tar.bz2 and Python-2.7.3.tar.xz Best, -- Jérémy Bethmo

Re: is this foolish?

2012-04-12 Thread Cameron Simpson
On 12Apr2012 19:43, Chris Angelico wrote: | On Thu, Apr 12, 2012 at 7:35 PM, Cameron Simpson wrote: | > I've found myself using a Python gotcha as a feature. | > I've got a budding mail filter program which keeps rule state in a | > little class instance. Slightly paraphrased: | > | >    class Ru

Re: is this foolish?

2012-04-12 Thread Chris Angelico
On Thu, Apr 12, 2012 at 7:35 PM, Cameron Simpson wrote: > I've found myself using a Python gotcha as a feature. > > I've got a budding mail filter program which keeps rule state in a > little class instance. Slightly paraphrased: > >    class RuleState(object): >        def __init__(self, M, maild

is this foolish?

2012-04-12 Thread Cameron Simpson
I've found myself using a Python gotcha as a feature. I've got a budding mail filter program which keeps rule state in a little class instance. Slightly paraphrased: class RuleState(object): def __init__(self, M, maildb_path, maildirs={}): [...] self.maildirs =

Sockets accept() in child processes

2012-04-12 Thread Thibaut DIRLIK
Hi, I'm writing a multiprocess server with Python 3.2 and the multiprocessing module. Here is my current implementation : - Main process: select() on a list of server sockets (different ips of the host, ssl or not, etc) - Children process : When they get a signal (in fact, a message in a pipe), t

Is it possible develop applications in python for android and which IDE could you recommend me (Eclipse, ...)???

2012-04-12 Thread sisifus
Hello all, I would like to know if it's possible develop android applications with python, making the apk package, etc. I don't want program from an android device only want to make programs for android from my PC. If it's possible which IDE could you recommend me? Thanks for your help Regards

Re: [Windows] drag-and-drop onto .py file in modern versions?

2012-04-12 Thread Chris Angelico
On Thu, Apr 12, 2012 at 4:02 PM, Karl Knechtel wrote: > Aside: when I double-click a .py file, what determines which Python will run > it? Is it a matter of which appears first in the PATH, or do I have to set > something else in the registry? Will a shebang line override the default on > Windows?