Re: Fatal Python error: PyCOND_WAIT(gil_cond) failed

2014-12-12 Thread dieter
keepplearningpython writes: > I am running ipython3 on Unix and constantly see this crash - > It happens when i try to issue commands on the ipython interactive shell. > > I have tried to set the PYTHONDIR to /var/tmp/ in case there was an issue > accessing the default location of the history fi

Re: list comprehension return a list and sum over in loop

2014-12-12 Thread KK Sasa
Sorry, i should say I'm using pythonxy, maybe it imports other things. -- https://mail.python.org/mailman/listinfo/python-list

Re: Python Script to convert firewall rules

2014-12-12 Thread Jason Friedman
> > > Thanks for the reply. Yes I can make the all possible keywords/values for > both formate. But after that what gonna be the logic to convert one format > to other format. Like to convert one line below are the keywords: > > set interface ethernet2/5 ip 10.17.10.1/24 (format 1) > set interfaces

Re: encrypt the http request url on the local machine

2014-12-12 Thread Michael Torrie
On 12/12/2014 08:53 AM, iMath wrote: > After some retinking on my question ,I found what I am really want is > not let any other guys using packet analyzer software know the > server name (host name) my software is sending data to . > > so I translate the host name to IP address format, it somewh

Re: is_ as method or property?

2014-12-12 Thread Mateusz Loskot
On 12 December 2014 at 22:14, Chris Angelico wrote: > On Sat, Dec 13, 2014 at 8:03 AM, Mateusz Loskot wrote: >> On 12 December 2014 at 12:26, Chris Angelico wrote: >>> On Fri, Dec 12, 2014 at 10:21 PM, Mateusz Loskot wrote: I've got several cases which are not obvious to me. For insta

Re: is_ as method or property?

2014-12-12 Thread Chris Angelico
On Sat, Dec 13, 2014 at 8:03 AM, Mateusz Loskot wrote: > On 12 December 2014 at 12:26, Chris Angelico wrote: >> On Fri, Dec 12, 2014 at 10:21 PM, Mateusz Loskot wrote: >>> I've got several cases which are not obvious to me. >>> For instance, class Foo has a boolean attribute, read-write, >>> whi

Re: is_ as method or property?

2014-12-12 Thread Mateusz Loskot
On 12 December 2014 at 12:26, Chris Angelico wrote: > On Fri, Dec 12, 2014 at 10:21 PM, Mateusz Loskot wrote: >> I've got several cases which are not obvious to me. >> For instance, class Foo has a boolean attribute, read-write, >> which I see a couple of realisations for possible: >> > > 0) Attr

Re: How to make subprocess run for 60 sec?

2014-12-12 Thread Akira Li
Dan Stromberg writes: > On Fri, Dec 12, 2014 at 12:48 AM, Robert Clove wrote: >> Hi All, >> >> I have the following python script that runs. >> I want is to run the subprocess to run for 60 sec and then send the SIGINT >> signal to subprocess and write the output in file. >> >> #!/usr/bin/python

Re: [Python-Dev] Python 2.x and 3.x use survey, 2014 edition

2014-12-12 Thread Barry Warsaw
On Dec 12, 2014, at 08:07 PM, Petr Viktorin wrote: >If anyone is wondering why their favorite Linux distribution is stuck with >Python 2 – well, I can only speak for Fedora, but nowadays most of what's >left are CPython bindings. No pylint --py3k or 2to3 will help there... It's true that some of

Re: [Python-Dev] Python 2.x and 3.x use survey, 2014 edition

2014-12-12 Thread Matthew Ruffalo
On 12/11/2014 09:48 PM, Terry Reedy wrote: > A possible reason: one is developing an app expected to be released > fall 2015 after the 3.5 release and the app depends on something new > in 3.5. I must admit though that I cannot think of any such thing now > for 3.5. For 3.3 there was the new unic

Re: Run Programming ?????

2014-12-12 Thread sohcahtoa82
> On Friday, December 12, 2014, William Ray Wing wrote: > > > > > On Dec 12, 2014, at 8:03 AM, Chris Warrick wrote: > > > > > On Dec 12, 2014 1:40 PM, "Delgado Motto" wrote: > > > > > > I travel alot, if not just interested in things of pocketable portability, > > and was curious if

Re: [Python-Dev] Python 2.x and 3.x use survey, 2014 edition

2014-12-12 Thread Petr Viktorin
Also keep in mind that not all Python libraries are on PyPI. For non-Python projects with Python bindings (think video players, OpenCV, systemd, Samba), distribution via PyPI doesn't make much sense. And since the Python bindings are usually second-class citizens, the porting doesn't have a high pr

Re: [Python-Dev] Python 2.x and 3.x use survey, 2014 edition

2014-12-12 Thread Mark Roberts
So, I'm more than aware of how to write Python 2/3 compatible code. I've ported 10-20 libraries to Python 3 and write Python 2/3 compatible code at work. I'm also aware of how much writing 2/3 compatible code makes me hate Python as a language. It'll be a happy day when one of the two languages die

Re: How to make subprocess run for 60 sec?

2014-12-12 Thread Dan Stromberg
On Fri, Dec 12, 2014 at 12:48 AM, Robert Clove wrote: > Hi All, > > I have the following python script that runs. > I want is to run the subprocess to run for 60 sec and then send the SIGINT > signal to subprocess and write the output in file. > > #!/usr/bin/python > import os > import subprocess

Re: list comprehension return a list and sum over in loop

2014-12-12 Thread Oscar Benjamin
On 12 December 2014 at 06:22, KK Sasa wrote: > Hi there, > > The list comprehension is results = [d2(t[k]) for k in xrange(1000)], where > d2 is a function returning a list, say [x1,x2,x3,x4] for one example. So > "results" is a list consisting of 1000 lists, each of length four. Here, what > I

Re: list comprehension return a list and sum over in loop

2014-12-12 Thread Peter Otten
KK Sasa wrote: > Peter Otten於 2014年12月12日星期五UTC+8下午8時32分55秒寫道: >> Jussi Piitulainen wrote: >> >> > KK Sasa writes: >> > >> >> def p(x,t,point,z,obs): >> >> d = x[0] >> >> tau = [0]+[x[1:point]] >> >> a = x[point:len(x)] >> >> at = sum(i*j for i, j in zip(a, t)) >> >> nu = [ex

Re: encrypt the http request url on the local machine

2014-12-12 Thread Chris Angelico
On Sat, Dec 13, 2014 at 2:53 AM, iMath wrote: > After some retinking on my question ,I found what I am really want is not let > any other guys using packet analyzer software know the server name (host > name) my software is sending data to . > > so I translate the host name to IP address format

Re: encrypt the http request url on the local machine

2014-12-12 Thread iMath
在 2014年12月9日星期二UTC+8下午2时58分36秒,iMath写道: > my software on the local machine needs to send http request to a specific web > server , is there any way to protect the http request url from being found by > Packet analyzer software like Wireshark and fiddler. The sever is not mine, > so I can do noth

Re: Call for speakers for the first PyCon Belarus. Python-announce

2014-12-12 Thread serge Guelton
On Fri, Dec 12, 2014 at 04:32:26PM +0300, Alina Dolgikh wrote: > Hello, dear community! > > I represent Belarusian Python community. We have regular monthly meet-ups > for 70-100 persons and we are going to develop further. > > We are planning to make the first Belarusian PyCon on the 31st of Jan

Re: Run Programming ?????

2014-12-12 Thread Chris Angelico
On Sat, Dec 13, 2014 at 2:43 AM, Delgado Motto wrote: > I was specifically talking POCKETABLE devices so Phablet or Telephone > preferably, simply hopeful as smaller machines continue to become more > capable, but I expected as much of this being a problem. Thanks. Those usually are terrible for

Re: Run Programming ?????

2014-12-12 Thread Delgado Motto
I was specifically talking POCKETABLE devices so Phablet or Telephone preferably, simply hopeful as smaller machines continue to become more capable, but I expected as much of this being a problem. Thanks. On Friday, December 12, 2014, William Ray Wing wrote: > > On Dec 12, 2014, at 8:03 AM, C

Re: Run Programming ?????

2014-12-12 Thread Chris Angelico
On Sat, Dec 13, 2014 at 2:03 AM, William Ray Wing wrote: > A MacBook Air is within a fraction of being as portable as an iPad, and can > easily do everything you want. If you are currently traveling with an iPad, > you _might_ even discover you prefer traveling with the MacBook. Or get some hard

Re: Run Programming ?????

2014-12-12 Thread William Ray Wing
> On Dec 12, 2014, at 8:03 AM, Chris Warrick wrote: > > > On Dec 12, 2014 1:40 PM, "Delgado Motto" > wrote: > > > > I travel alot, if not just interested in things of pocketable portability, > > and was curious if you can tell me if Python can be LEARNED from begi

Re: beautifulsoup VS lxml

2014-12-12 Thread iMath
在 2014年12月12日星期五UTC+8上午10时19分56秒,Michael Torrie写道: > On 12/11/2014 07:02 PM, iMath wrote: > > > > which is more easy and elegant for pulling data out of HTML? > > Beautiful Soup is specialized for HTML parsing, and it can deal with > badly formed HTML, but if I recall correctly BeautifulSoup can

Python REST API Wrapper framework?

2014-12-12 Thread Alec Taylor
It's not overly difficult to build a wrapper of someones RESTfull HTTP API using something like: urllib2 or requests. However, there is still a decent amount of generic boilerplate required. Are there any decent frameworks around which reduce the amount of boilerplate required to consume 3rd-part

Re: list comprehension return a list and sum over in loop

2014-12-12 Thread KK Sasa
Peter Otten於 2014年12月12日星期五UTC+8下午8時32分55秒寫道: > Jussi Piitulainen wrote: > > > KK Sasa writes: > > > >> def p(x,t,point,z,obs): > >> d = x[0] > >> tau = [0]+[x[1:point]] > >> a = x[point:len(x)] > >> at = sum(i*j for i, j in zip(a, t)) > >> nu = [exp(z[k]*(at-d)-sum(tau[k])) f

Re: list comprehension return a list and sum over in loop

2014-12-12 Thread KK Sasa
Jussi Piitulainen於 2014年12月12日星期五UTC+8下午7時12分39秒寫道: > KK Sasa writes: > > > def p(x,t,point,z,obs): > > d = x[0] > > tau = [0]+[x[1:point]] > > a = x[point:len(x)] > > at = sum(i*j for i, j in zip(a, t)) > > nu = [exp(z[k]*(at-d)-sum(tau[k])) for k in xrange(point)] > >

Re: Run Programming ?????

2014-12-12 Thread Chris Warrick
On Dec 12, 2014 1:40 PM, "Delgado Motto" wrote: > > I travel alot, if not just interested in things of pocketable portability, and was curious if you can tell me if Python can be LEARNED from beginner on an IOS device ( with interest of being able to test my code, possibly even if a free website i

Re: [newbie] how to make program suggest to install missing modules

2014-12-12 Thread Chris Warrick
On Dec 12, 2014 11:56 AM, "hugocoolens" wrote: > > On Monday, December 8, 2014 9:00:13 PM UTC+1, sohca...@gmail.com wrote: > > On Monday, December 8, 2014 10:46:47 AM UTC-8, Jean-Michel Pichavant wrote: > > > - Original Message - > > > > From: sohcahto...@gmail.com > > > > try: > > > >

Run Programming ?????

2014-12-12 Thread Delgado Motto
I travel alot, if not just interested in things of pocketable portability, and was curious if you can tell me if Python can be LEARNED from beginner on an IOS device ( with interest of being able to test my code, possibly even if a free website is capable of reviewing scripts ) but if not then I pr

Re: list comprehension return a list and sum over in loop

2014-12-12 Thread Peter Otten
Jussi Piitulainen wrote: > KK Sasa writes: > >> def p(x,t,point,z,obs): >> d = x[0] >> tau = [0]+[x[1:point]] >> a = x[point:len(x)] >> at = sum(i*j for i, j in zip(a, t)) >> nu = [exp(z[k]*(at-d)-sum(tau[k])) for k in xrange(point)] >> de = sum(nu, axis=0) >> probabil

Re: is_ as method or property?

2014-12-12 Thread Chris Angelico
On Fri, Dec 12, 2014 at 10:21 PM, Mateusz Loskot wrote: > I've got several cases which are not obvious to me. > For instance, class Foo has a boolean attribute, read-write, > which I see a couple of realisations for possible: > 0) Attribute only. class Foo: pass Foo().default = True Unless

Re: is_ as method or property?

2014-12-12 Thread Mateusz Loskot
On 11 December 2014 at 19:20, Chris Angelico wrote: > On Fri, Dec 12, 2014 at 4:34 AM, Mateusz Loskot wrote: >> If a class member function simply tests something and >> returns a b::oolean call it >> >> def is_(): >> pass >> >> like 'is_even'. >> >> Should I define it as a classic method >> >> d

Re: list comprehension return a list and sum over in loop

2014-12-12 Thread Jussi Piitulainen
KK Sasa writes: > def p(x,t,point,z,obs): > d = x[0] > tau = [0]+[x[1:point]] > a = x[point:len(x)] > at = sum(i*j for i, j in zip(a, t)) > nu = [exp(z[k]*(at-d)-sum(tau[k])) for k in xrange(point)] > de = sum(nu, axis=0) > probability = [nu[k]/de for k in xrange(p

Re: [newbie] how to make program suggest to install missing modules

2014-12-12 Thread hugocoolens
On Monday, December 8, 2014 9:00:13 PM UTC+1, sohca...@gmail.com wrote: > On Monday, December 8, 2014 10:46:47 AM UTC-8, Jean-Michel Pichavant wrote: > > - Original Message - > > > From: sohcahto...@gmail.com > > > try: > > > import someModule > > > except ImportError: > > > print "

Re: Extension of while syntax

2014-12-12 Thread Marko Rauhamaa
c...@isbd.net: > Marko Rauhamaa wrote: >> Chris Angelico : >> >> > You could deduplicate it by shifting the condition: >> > >> > while True: >> > value = get_some_value() >> > if value not in undesired_values: break >> > >> > But I'm not sure how common this idiom actually is. >> >> Ext

Re: list comprehension return a list and sum over in loop

2014-12-12 Thread Steven D'Aprano
KK Sasa wrote: > Hi there, > > The list comprehension is results = [d2(t[k]) for k in xrange(1000)], > where d2 is a function returning a list, say [x1,x2,x3,x4] for one > example. So "results" is a list consisting of 1000 lists, each of length > four. Here, what I want to get is the sum of 1000

Re: list comprehension return a list and sum over in loop

2014-12-12 Thread KK Sasa
Peter Otten於 2014年12月12日星期五UTC+8下午5時13分58秒寫道: > KK Sasa wrote: > > > Mark Lawrence於 2014年12月12日星期五UTC+8下午3時17分43秒寫道: > >> On 12/12/2014 06:22, KK Sasa wrote: > >> > Hi there, > >> > > >> > The list comprehension is results = [d2(t[k]) for k in xrange(1000)], > >> > where d2 is a function returning

encoding name mappings in codecs.py with email/charset.py

2014-12-12 Thread Stefanos Karasavvidis
I've hit a wall with mailman which seems to be caused by pyhon's character encoding names. I've narrowed the problem down to the email/charset.py file. Basically the following happens: given an encoding name as 'iso-8859-X' it is transformed to 'iso8859-X' (without the first dash). This happens w

Re: Extension of while syntax

2014-12-12 Thread cl
Marko Rauhamaa wrote: > Chris Angelico : > > > You could deduplicate it by shifting the condition: > > > > while True: > > value = get_some_value() > > if value not in undesired_values: break > > > > But I'm not sure how common this idiom actually is. > > Extremely common, and not only i

Re: list comprehension return a list and sum over in loop

2014-12-12 Thread Peter Otten
KK Sasa wrote: > Mark Lawrence於 2014年12月12日星期五UTC+8下午3時17分43秒寫道: >> On 12/12/2014 06:22, KK Sasa wrote: >> > Hi there, >> > >> > The list comprehension is results = [d2(t[k]) for k in xrange(1000)], >> > where d2 is a function returning a list, say [x1,x2,x3,x4] for one >> > example. So "results"

Re: list comprehension return a list and sum over in loop

2014-12-12 Thread Christian Gollwitzer
Am 12.12.14 09:30, schrieb KK Sasa: Mark Lawrence於 2014年12月12日星期五UTC+8下午3時17分43秒寫道: Hi Mark and Yotam, Thanks for kind reply. I think I didn't make my problem clear enough. The slow part is "[d2(t[k]) for k in xrange(1000)]". In addition, I don't need to construct a list of 1000 lists inside, but

How to make subprocess run for 60 sec?

2014-12-12 Thread Robert Clove
Hi All, I have the following python script that runs. I want is to run the subprocess to run for 60 sec and then send the SIGINT signal to subprocess and write the output in file. #!/usr/bin/python import os import subprocess PIPE = subprocess.PIPE import signal import time def handler(signum, f

Re: PyQt: user interface freezed when using concurrent.futures.ThreadPoolExecutor

2014-12-12 Thread Marko Rauhamaa
Chris Angelico : > And I don't remember how Java did things, except that I struggled to > find basic fundamental primitives like semaphores, and had to use > synchronized functions/objects instead. Java now has a diverse set of synchornization facilities, but the builtin object synchronization pr

Re: list comprehension return a list and sum over in loop

2014-12-12 Thread KK Sasa
Mark Lawrence於 2014年12月12日星期五UTC+8下午3時17分43秒寫道: > On 12/12/2014 06:22, KK Sasa wrote: > > Hi there, > > > > The list comprehension is results = [d2(t[k]) for k in xrange(1000)], where > > d2 is a function returning a list, say [x1,x2,x3,x4] for one example. So > > "results" is a list consisting o

Re: Extension of while syntax

2014-12-12 Thread Marko Rauhamaa
Chris Angelico : > On Fri, Dec 12, 2014 at 6:10 PM, Marko Rauhamaa wrote: >> Chris Angelico : >> >>> You could deduplicate it by shifting the condition: >>> >>> while True: >>> value = get_some_value() >>> if value not in undesired_values: break >>> >>> But I'm not sure how common this id

Re: Extension of while syntax

2014-12-12 Thread Chris Angelico
On Fri, Dec 12, 2014 at 7:00 PM, Mark Lawrence wrote: > It won't happen as different format loops have been discussed and rejected > umpteen times over the last 20 odd years, mainly because the code can be > restructured using break as others have already pointed out. Unless of > course you fork

Re: Extension of while syntax

2014-12-12 Thread Mark Lawrence
On 12/12/2014 02:21, Nelson Crosby wrote: I was thinking a bit about the following pattern: value = get_some_value() while value in undesired_values: value = get_some_value() I've always hated code that looks like this. Partly due to the repetition, but partly also due to the fact that wi