Why generators take long time?

2016-01-18 Thread Arshpreet Singh
I was playing with Generators and found that using Generators time is bit more than list-comprehensions or I am doing it wrong? Function with List comprehensions: def sum_text(number_range): return sum([i*i for i in xrange(number_range)]) %timeit sum_text(1) 1 loops, best of 3: 14

Re[2]: Python.Exe Problem

2016-01-18 Thread MRAB
On 2016-01-18 23:17:10, mateusz.nasciszew...@gmail.com wrote: Hello, I have the exact same issue. I've installed Python 3.5 AMD64 from python.org (https://www.python.org/ftp/python/3.5.0/python-3.5.0a1-amd64.exe to be exact), and I've checked the installer MD5sum to be valid. I've selected th

Re: Python.Exe Problem

2016-01-18 Thread Mateusz Naściszewski
W dniu wtorek, 19 stycznia 2016 00:42:20 UTC+1 użytkownik eryk sun napisał: > On Mon, Jan 18, 2016 at 5:17 PM, wrote: > > > > I've installed Python 3.5 AMD64 from python.org > > (https://www.python.org/ftp/python/3.5.0/python-3.5.0a1-amd64.exe to be > > exact), > > 3.5.0a1 is the first alpha ve

Re: Python and Word OLE

2016-01-18 Thread tdsperth
On Friday, January 15, 2016 at 2:04:08 PM UTC+8, tdsp...@gmail.com wrote: > Hi All > > I am trying to change the active printer using win32com.client with the > following code > > > > wordapp = win32com.client.Dispatch('Word.Application') > worddoc = wordapp.Documents.Open(mypathfile) > print

Re: Python.Exe Problem

2016-01-18 Thread eryk sun
On Mon, Jan 18, 2016 at 5:17 PM, wrote: > > I've installed Python 3.5 AMD64 from python.org > (https://www.python.org/ftp/python/3.5.0/python-3.5.0a1-amd64.exe to be > exact), 3.5.0a1 is the first alpha version, released 7 months before the final version of 3.5.0. Remove it, and install 3.5.1 u

Re: Python.Exe Problem

2016-01-18 Thread mateusz . nasciszewski
Hello, I have the exact same issue. I've installed Python 3.5 AMD64 from python.org (https://www.python.org/ftp/python/3.5.0/python-3.5.0a1-amd64.exe to be exact), and I've checked the installer MD5sum to be valid. I've selected the advanced install to change installation directory and to preco

Re: Question about function parameter copy

2016-01-18 Thread Random832
On Mon, Jan 18, 2016, at 13:44, Robert wrote: > cdef inline dtype_t _logsumexp(dtype_t[:] X) nogil: > . > > fwdlattice[t, j] = _logsumexp(work_buffer) + framelogprob[t, j] > > I find that [:] is about object copy, but I am not sure about its usage > here in a function parameter. W

Question about function parameter copy

2016-01-18 Thread Robert
Hi, I see the following line in a cython file (.pyx): cdef inline dtype_t _logsumexp(dtype_t[:] X) nogil: . fwdlattice[t, j] = _logsumexp(work_buffer) + framelogprob[t, j] I find that [:] is about object copy, but I am not sure about its usage here in a function parameter. Whet

Re: When is an int not an int? Who can explain this?

2016-01-18 Thread Chris Angelico
On Tue, Jan 19, 2016 at 4:00 AM, Ian Kelly wrote: >> Armed with that information, you should be able to track down what's >> going on. It's curious, though, that you have a callable subclass of >> module bound to the name int. Very curious indeed. > > What makes you think that it's a callable subc

Re: When is an int not an int? Who can explain this?

2016-01-18 Thread Random832
On Mon, Jan 18, 2016, at 11:51, Chris Angelico wrote: > Armed with that information, you should be able to track down what's > going on. It's curious, though, that you have a callable subclass of > module bound to the name int. Very curious indeed. He hasn't tried calling it. And there's no reason

Re: When is an int not an int? Who can explain this?

2016-01-18 Thread Ian Kelly
On Mon, Jan 18, 2016 at 9:51 AM, Chris Angelico wrote: > On Tue, Jan 19, 2016 at 3:28 AM, Charles T. Smith >> Okay, I think I understand it now: >> >> (PDB)type (int) >> >> >> (PDB)type (float) >> > > And that's pretty strong evidence right there! So the next question > is... what got imported u

Re: parallel (concurrent) eventlet

2016-01-18 Thread Ian Kelly
On Mon, Jan 18, 2016 at 8:03 AM, David Gabriel wrote: > Dears, > > Let me add one more detail: When I add these two lines to check whether my > modules are monkey_patched or not I get *False* as a result. > I think it is strange to get this result since I patched my modules at the > beginning usin

Re: When is an int not an int? Who can explain this?

2016-01-18 Thread Chris Angelico
On Tue, Jan 19, 2016 at 3:28 AM, Charles T. Smith wrote: > On Tue, 19 Jan 2016 03:19:59 +1100, Chris Angelico wrote: >> Possibility #1: 'int' has been rebound. >> >> Possibility #2: 'type' has been rebound. >> >> I'd check them in that order. >> >> ChrisA > > > But: > > (PDB)p 5 + 0 > 5 That show

Re: When is an int not an int? Who can explain this?

2016-01-18 Thread Charles T. Smith
On Tue, 19 Jan 2016 03:19:59 +1100, Chris Angelico wrote: > On Tue, Jan 19, 2016 at 3:11 AM, Charles T. Smith > wrote: >> $ python >> Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) [GCC 4.4.3] on linux2 >> Type "help", "copyright", "credits" or "license" for more information. > type(0) is i

Re: When is an int not an int? Who can explain this?

2016-01-18 Thread Chris Angelico
On Tue, Jan 19, 2016 at 3:11 AM, Charles T. Smith wrote: > $ python > Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) > [GCC 4.4.3] on linux2 > Type "help", "copyright", "credits" or "license" for more information. type(0) is int > True > ... > (PDB)type(0) is int > False > (PDB)type(1) is i

When is an int not an int? Who can explain this?

2016-01-18 Thread Charles T. Smith
$ python Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) [GCC 4.4.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> type(0) is int True ... (PDB)type(0) is int False (PDB)type(1) is int False (PDB)p 5 + 0 5 (PDB)class c (object): pass (PDB)type (c()) is c T

Re: parallel (concurrent) eventlet

2016-01-18 Thread David Gabriel
Dears, Let me add one more detail: When I add these two lines to check whether my modules are monkey_patched or not I get *False* as a result. I think it is strange to get this result since I patched my modules at the beginning using: eventlet.monkey_patch() as detailed here

Re: Powerful perl paradigm I don't find in python

2016-01-18 Thread Wolfgang Maier
On 1/18/2016 14:05, Charles T. Smith wrote: On Fri, 15 Jan 2016 14:20:17 +0100, Wolfgang Maier wrote: pattern = pattern_str.compile() try: matches = pattern.findall(some_str, endpos=some_str.index(tail)) except ValueError: # do something if tail is not found pass Oh! I thin

Re: Powerful perl paradigm I don't find in python

2016-01-18 Thread Charles T. Smith
On Fri, 15 Jan 2016 14:20:17 +0100, Wolfgang Maier wrote: > pattern = pattern_str.compile() > try: > matches = pattern.findall(some_str, endpos=some_str.index(tail)) > except ValueError: > # do something if tail is not found > pass Oh! I think that's it! matches = findall (patte

parallel (concurrent) eventlet

2016-01-18 Thread David Gabriel
Dears, I have an issue when I use eventlet Api to create parallel threads. In fact, when I run the below code, only the program dealing with the synchronozation with ldap data base is working and is continuously blocking the others to run. But, when I use the 'thread' Api the program is working fi