Re: Question

2016-03-08 Thread Jon Ribbens
On 2016-03-08, justin walters wrote: > Well, from that error message, it seems like you may have a permissions > issue. If that's true then it means the Python 3.5 installer is broken. However, I don't think it is true as actually running Python presents no problems. There's some bug in virtualen

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-08 Thread BartC
On 08/03/2016 02:45, Mark Lawrence wrote: On 08/03/2016 01:47, BartC wrote: The Python timing for that file is around 20 seconds, time enough to read 1 copies from the disk. And a C program reads /and decodes/ the same file from the same disk in between 0.1 and 0.2 seconds. So how much

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-08 Thread BartC
On 08/03/2016 02:47, MRAB wrote: On 2016-03-08 01:33, BartC wrote: Compared with 2.7, 3.4 above is spending nearly an extra ten seconds doing what? I can't understand why someone just wouldn't care. Part of it will be that Python 2 has 2 integer types: 'int' (fixed length) and 'long' (v

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-08 Thread Jussi Piitulainen
BartC writes: > On 08/03/2016 02:47, MRAB wrote: >> On 2016-03-08 01:33, BartC wrote: > >>> Compared with 2.7, 3.4 above is spending nearly an extra ten seconds >>> doing what? I can't understand why someone just wouldn't care. >>> >> Part of it will be that Python 2 has 2 integer types: 'int

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-08 Thread BartC
On 08/03/2016 02:12, Steven D'Aprano wrote: On Tue, 8 Mar 2016 09:39 am, BartC wrote: I'm using it because this kind of file reading in Python is a mess. If I do a read, will I get a string, a byte sequence object, a byte-array, or array-array, or what? Calling it "a mess" is an exaggeration

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-08 Thread BartC
On 08/03/2016 11:45, Jussi Piitulainen wrote: BartC writes: On 08/03/2016 02:47, MRAB wrote: On 2016-03-08 01:33, BartC wrote: Compared with 2.7, 3.4 above is spending nearly an extra ten seconds doing what? I can't understand why someone just wouldn't care. Part of it will be that P

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-08 Thread Serhiy Storchaka
On 08.03.16 04:12, Steven D'Aprano wrote: [steve@ando ~]$ python3.3 -m timeit -s 'from fp import Float' 'Float("1234.567")' 10 loops, best of 3: 13.6 usec per loop [steve@ando ~]$ python/python-dev/3.5/python -m timeit -s 'from fp import Float' 'Float("1234.567")' 1 loops, best of 3: 54

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-08 Thread Serhiy Storchaka
On 08.03.16 03:34, Steven D'Aprano wrote: Chris, I think that's exactly what BartC has done: he has a program that he actually uses, one which processes JPG files. It's written in pure Python, so he's not comparing the quality of C libraries, he's comparing Python versus Python. I haven't looked

Re: Pythonic love

2016-03-08 Thread jmp
On 03/07/2016 11:51 PM, Fillmore wrote: learning Python from Perl here. Want to do things as Pythonicly as possible. I am reading a TSV, but need to skip the first 5 lines. The following works, but wonder if there's a more pythonc way to do things. Thanks ctr = 0 with open(prfile,mode="rt",enc

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-08 Thread BartC
On 08/03/2016 04:40, Steven D'Aprano wrote: On Tuesday 08 March 2016 12:41, BartC wrote: On 08/03/2016 01:19, Steven D'Aprano wrote: On Tue, 8 Mar 2016 07:19 am, BartC wrote: I don't have to hand a jpeg file that it can't decode. Run this under Python 2: from random import randint blob =

Path problem with 3.5.1

2016-03-08 Thread leon_heller--- via Python-list
Although I've enabled setting the path when installing 3.5.1 (Win7 x64) I can't run Python from the command line in a terminal window. It works OK on a Raspberry Pi 3! Leon -- Leon Heller G1HSM -- https://mail.python.org/mailman/listinfo/python-list

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-08 Thread Mark Lawrence
On 08/03/2016 11:09, BartC wrote: On 08/03/2016 02:45, Mark Lawrence wrote: On 08/03/2016 01:47, BartC wrote: The Python timing for that file is around 20 seconds, time enough to read 1 copies from the disk. And a C program reads /and decodes/ the same file from the same disk in between

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-08 Thread Mark Lawrence
On 08/03/2016 13:49, BartC wrote: On 08/03/2016 04:40, Steven D'Aprano wrote: On Tuesday 08 March 2016 12:41, BartC wrote: Nevertheless, in the real world, you have to deal with corrupt JPGs and files mislabelled as JPGs. And "crashing" doesn't count as "deal with" :-) OK, I changed the 'rais

Tiny python code I dont understand

2016-03-08 Thread ast
Hello lst = [(1,2,3), (4, 5,6)] sum(lst, ()) (1, 2, 3, 4, 5, 6) Any explanations ? thx -- https://mail.python.org/mailman/listinfo/python-list

Re: Tiny python code I dont understand

2016-03-08 Thread Jussi Piitulainen
ast writes: > Hello > lst = [(1,2,3), (4, 5,6)] sum(lst, ()) > (1, 2, 3, 4, 5, 6) > > Any explanations ? (() + (1,2,3)) + (4,5,6) -- https://mail.python.org/mailman/listinfo/python-list

Re: Tiny python code I dont understand

2016-03-08 Thread ast
"Jussi Piitulainen" a écrit dans le message de news:lf58u1t53sb@ling.helsinki.fi... ast writes: Hello lst = [(1,2,3), (4, 5,6)] sum(lst, ()) (1, 2, 3, 4, 5, 6) Any explanations ? (() + (1,2,3)) + (4,5,6) yes, ty -- https://mail.python.org/mailman/listinfo/python-list

Re: Tiny python code I dont understand

2016-03-08 Thread ast
"ast" a écrit dans le message de news:56defc8e$0$3341$426a7...@news.free.fr... Hello lst = [(1,2,3), (4, 5,6)] sum(lst, ()) (1, 2, 3, 4, 5, 6) Any explanations ? thx OK, sorry, I finally understand. This is because adding tuple (or list or string ...) is a concatenation () + (1,2,3) + (

Re: Question

2016-03-08 Thread justin walters
My apologies, but I really don't want to argue with you. You may want to be a bit more humble when asking for help. On Mar 8, 2016 2:31 AM, "Jon Ribbens" wrote: > On 2016-03-08, justin walters wrote: > > Well, from that error message, it seems like you may have a permissions > > issue. > > If th

Re: Pythonic love

2016-03-08 Thread justin walters
Correct me if I'm wrong, but don't python generators usually use the yield statement so they can be used in list comprehensions? On Mar 8, 2016 5:27 AM, "jmp" wrote: > On 03/07/2016 11:51 PM, Fillmore wrote: > >> >> learning Python from Perl here. Want to do things as Pythonicly as >> possible. >

Re: Question

2016-03-08 Thread Jon Ribbens
On 2016-03-08, justin walters wrote: > My apologies, but I really don't want to argue with you. That's nice to know. I didn't ask you to, but it's great to have your input anyway. > You may want to be a bit more humble when asking for help. I wasn't asking for help. HTH. -- https://mail.python

Re: Pythonic love

2016-03-08 Thread Mark Lawrence
On 08/03/2016 16:49, justin walters wrote: Correct me if I'm wrong, but don't python generators usually use the yield statement so they can be used in list comprehensions? Please don't top post on this list, thanks. -- My fellow Pythonistas, ask not what our language can do for you, ask what y

Re: Pythonic love

2016-03-08 Thread jmp
On 03/08/2016 05:49 PM, justin walters wrote: Correct me if I'm wrong, but don't python generators usually use the yield statement so they can be used in list comprehensions? Hello, Please don't top post. Generator expressions are different from generator functions. They are both generators

Re: Pythonic love

2016-03-08 Thread justin walters
Sorry about the top posting. I'm new to mailing lists. I should just reply to the python-list@python.org address then? Also, thank you for the generator clarification. On Mar 8, 2016 9:09 AM, "jmp" wrote: > On 03/08/2016 05:49 PM, justin walters wrote: > >> Correct me if I'm wrong, but don't pyt

Re: Question

2016-03-08 Thread Ian Kelly
On Mon, Mar 7, 2016 at 6:41 PM, Jon Ribbens wrote: > On 2016-03-07, Ian Kelly wrote: >> On Mon, Mar 7, 2016 at 11:51 AM, Jon Ribbens >> wrote: >>> I must say that Python on Windows was a very poor experience indeed, >>> "virtualenv" does not work and "venv" refuses to create the 'activate' >>> sh

Re: Pythonic love

2016-03-08 Thread Javier Novoa C.
justin walters writes: > Sorry about the top posting. I'm new to mailing lists. I should just reply > to the python-list@python.org address then? > > Also, thank you for the generator clarification. > On Mar 8, 2016 9:09 AM, "jmp" wrote: ^ that's top posting always reply inline or at the bo

Re: Question

2016-03-08 Thread Jon Ribbens
On 2016-03-08, Ian Kelly wrote: > On Mon, Mar 7, 2016 at 6:41 PM, Jon Ribbens > wrote: >> It's not activate.bat, it's activate (no file extension) the posix >> shell script. I installed Git for Windows which provides bash (or >> something that looks like it). Python venv doesn't cope with this >>

Re: Question

2016-03-08 Thread Ian Kelly
On Tue, Mar 8, 2016 at 10:56 AM, Jon Ribbens wrote: > The only things I can think of that are at all 'weird' are that there > are spaces in the filenames, and there's more than one drive. But > the former of those is utterly standard for Windows, and the latter > doesn't really even rise to the le

Re: Question

2016-03-08 Thread Jon Ribbens
On 2016-03-08, Ian Kelly wrote: > On Tue, Mar 8, 2016 at 10:56 AM, Jon Ribbens > wrote: >> The only things I can think of that are at all 'weird' are that there >> are spaces in the filenames, and there's more than one drive. But >> the former of those is utterly standard for Windows, and the latt

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-08 Thread BartC
On 08/03/2016 16:15, Mark Lawrence wrote: On 08/03/2016 13:49, BartC wrote: On 08/03/2016 04:40, Steven D'Aprano wrote: On Tuesday 08 March 2016 12:41, BartC wrote: Nevertheless, in the real world, you have to deal with corrupt JPGs and files mislabelled as JPGs. And "crashing" doesn't count a

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-08 Thread BartC
On 08/03/2016 16:09, Mark Lawrence wrote: On 08/03/2016 11:09, BartC wrote: On 08/03/2016 02:45, Mark Lawrence wrote: On 08/03/2016 01:47, BartC wrote: The Python timing for that file is around 20 seconds, time enough to read 1 copies from the disk. And a C program reads /and decodes/ t

EuroPython 2016: Financial Aid Available

2016-03-08 Thread M.-A. Lemburg
We are happy to announce a program for people in need of financial aid to attend EuroPython. You can find all the details on our financial aid page: *** https://ep2016.europython.eu/en/registration/financial-aid/ *** Financial Aid Program In short, we will be givin

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-08 Thread Mark Lawrence
On 08/03/2016 19:15, BartC wrote: On 08/03/2016 16:09, Mark Lawrence wrote: On 08/03/2016 11:09, BartC wrote: On 08/03/2016 02:45, Mark Lawrence wrote: On 08/03/2016 01:47, BartC wrote: The Python timing for that file is around 20 seconds, time enough to read 1 copies from the disk. An

Re: Installing ssdeep on Portable Python

2016-03-08 Thread morr . drew
Were you able to solve this problem? I am also seeing this On Thursday, March 20, 2014 at 2:22:19 PM UTC-4, lagu...@mail.com wrote: > Portable Python 2.7 for Windows, the Python application have dependency on > ssdeep-2.10, which is a binary exe. > > The ssdeep (libfuzzy) installation example wa

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-08 Thread BartC
On 08/03/2016 20:44, Mark Lawrence wrote: On 08/03/2016 19:15, BartC wrote: Surely the start-up time would be the same no matter what the input. Unless all of the background jobs are kicking in when you're testing. I assume that you do take such factors into account, by repeating your test

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-08 Thread Steven D'Aprano
On Tue, 8 Mar 2016 10:53 pm, BartC wrote: > On 08/03/2016 02:12, Steven D'Aprano wrote: >> On Tue, 8 Mar 2016 09:39 am, BartC wrote: > >>> I'm using it because this kind of file reading in Python is a mess. If I >>> do a read, will I get a string, a byte sequence object, a byte-array, or >>> arra

Re: Question

2016-03-08 Thread Steven D'Aprano
On Wed, 9 Mar 2016 04:19 am, Ian Kelly wrote: > On Mon, Mar 7, 2016 at 6:41 PM, Jon Ribbens > wrote: >> On 2016-03-07, Ian Kelly wrote: >>> On Mon, Mar 7, 2016 at 11:51 AM, Jon Ribbens >>> wrote: I must say that Python on Windows was a very poor experience indeed, Indeed. Development on Wi

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-08 Thread Steven D'Aprano
On Wed, 9 Mar 2016 06:15 am, BartC wrote: [...] > But this was hardly necessary as it was so obvious: it takes 150ms to > process a 300-pixel image, 20 seconds for a 2Mpixel one, and (I have to > switch to PyPy here as I've never had time to hang about for it) 180 > seconds for 80Mpixel file. > >

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-08 Thread Steven D'Aprano
On Wed, 9 Mar 2016 12:49 am, BartC wrote: >> Nevertheless, in the real world, you have to deal with corrupt JPGs and >> files mislabelled as JPGs. And "crashing" doesn't count as "deal with" >> :-) > > OK, I changed the 'raise' line to 'exit(0)'. Job done! Possibly a really amateurish, lazy job

Re: Question

2016-03-08 Thread Chris Angelico
On Wed, Mar 9, 2016 at 10:52 AM, Steven D'Aprano wrote: >> Well, running bash on Windows is decidedly non-standard. This is like >> installing a Python package on a Linux system and then complaining >> that it won't run under wine. I don't think that Python should be >> expected to provide an acti

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-08 Thread BartC
On 08/03/2016 23:28, Steven D'Aprano wrote: On Tue, 8 Mar 2016 10:53 pm, BartC wrote: Python 2 Python 3 Text mode 'str' 'str' Binary mode 'bytes''str' That table is incorrect. In Python 2, bytes is just an alias for str: [steve@ando ~]$ python2.7

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-08 Thread Chris Angelico
On Wed, Mar 9, 2016 at 11:09 AM, BartC wrote: > On 08/03/2016 23:28, Steven D'Aprano wrote: >> >> Here it is in a table form: >> >> >> Mode Python 2 Python 3 >> >> Text bytes text >> Binarybytes bytes >> ---

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-08 Thread Michael Torrie
On 03/07/2016 05:45 PM, Chris Angelico wrote: > On Tue, Mar 8, 2016 at 11:22 AM, BartC wrote: >> >> (Is a byte string the same as a byte array? Is a byte array the same as an >> array.array? If I remove this line from my code, where 'data' has just been >> read from a file: >> >>data=array.arr

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-08 Thread Chris Angelico
On Wed, Mar 9, 2016 at 11:34 AM, Michael Torrie wrote: > On 03/07/2016 05:45 PM, Chris Angelico wrote: >> On Tue, Mar 8, 2016 at 11:22 AM, BartC wrote: >>> >>> (Is a byte string the same as a byte array? Is a byte array the same as an >>> array.array? If I remove this line from my code, where 'da

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-08 Thread Michael Torrie
On 03/07/2016 11:34 AM, BartC wrote: > (I'm quite pleased with my version: smaller, faster, works on all the > Pythons, supports all 3 colour formats and no decoding bugs that I'm > aware of, and it's the first Python program I've written that does > something useful.) I think you should be com

Re: Path problem with 3.5.1

2016-03-08 Thread Terry Reedy
On 3/8/2016 8:47 AM, leon_heller--- via Python-list wrote: Although I've enabled setting the path when installing 3.5.1 (Win7 x64) I can't run Python from the command line in a terminal window. It works OK on a Raspberry Pi 3! If you type 'PATH' at the command prompt, what is the response? --

Re: Question

2016-03-08 Thread Ian Kelly
On Tue, Mar 8, 2016 at 5:13 PM, Chris Angelico wrote: > On Wed, Mar 9, 2016 at 10:52 AM, Steven D'Aprano wrote: >>> Well, running bash on Windows is decidedly non-standard. This is like >>> installing a Python package on a Linux system and then complaining >>> that it won't run under wine. I don'

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-08 Thread BartC
On 09/03/2016 00:04, Steven D'Aprano wrote: On Wed, 9 Mar 2016 12:49 am, BartC wrote: Nevertheless, in the real world, you have to deal with corrupt JPGs and files mislabelled as JPGs. And "crashing" doesn't count as "deal with" :-) OK, I changed the 'raise' line to 'exit(0)'. Job done! Po

Creating barrel distortion of video

2016-03-08 Thread semeon . risom
Hello - This may seem like an odd request for the main python google group, but I thought this question might have answers coming from different backgrounds that utilize python. I'm trying to find a way of rendering an optical distortion on a video I will be presenting through the use of a hea

Re: Creating barrel distortion of video

2016-03-08 Thread Ben Finney
semeon.ri...@gmail.com writes: > This may seem like an odd request for the main python google group (Note that this is not a Google group. Google may be presenting this forum to you, but it's not exclusive to Google and many of us don't participate there.) > but I thought this question might hav

Re: Creating barrel distortion of video

2016-03-08 Thread Chris Angelico
On Wed, Mar 9, 2016 at 12:32 PM, wrote: > This may seem like an odd request for the main python google group, but I > thought this question might have answers coming from different backgrounds > that utilize python. > > I'm trying to find a way of rendering an optical distortion on a video I wi

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-08 Thread Steven D'Aprano
On Wed, 9 Mar 2016 11:34 am, Michael Torrie wrote: > There are some interesting differences I found between a Python 2 string > (composed of bytes) and a Python 3 byte string, such as what you'd get > from calling read() on a file handle opened in binary mode. That is in > Python 2, indexing a st

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-08 Thread Steven D'Aprano
On Wed, 9 Mar 2016 12:28 pm, BartC wrote: > (Which wasn't as painful as I'd expected. However the next project I > have in mind is 20K lines rather than 0.7K. For that I'm looking at some > mechanical translation I think. And probably some library to wrap around > Python's i/o.) You almost certai

Review Request of Python Code

2016-03-08 Thread subhabangalore
Dear Group, I am trying to write a code for pulling data from MySQL at the backend and annotating words and trying to put the results as separated sentences with each line. The code is generally running fine but I am feeling it may be better in the end of giving out sentences, and for small dat

Re: Creating barrel distortion of video

2016-03-08 Thread Steven D'Aprano
On Wednesday 09 March 2016 12:52, Chris Angelico wrote: > On Wed, Mar 9, 2016 at 12:32 PM, wrote: >> This may seem like an odd request for the main python google group, but I >> thought this question might have answers coming from different >> backgrounds that utilize python. >> >> I'm trying to

Re: Review Request of Python Code

2016-03-08 Thread Steven D'Aprano
On Wednesday 09 March 2016 15:18, subhabangal...@gmail.com wrote: > I am trying to copy the code here, for your kind review. > > import MySQLdb > import nltk > def sql_connect_NewTest1(): This function says that it connects to the SQL database, but actually does much more. It does too much. Spl

exec "x = 3; print x" in a - How does it work?

2016-03-08 Thread Veek. M
What is the return value of `exec`? Would that object be then used to iterate the sequence in 'a'? I'm reading this: https://www.python.org/download/releases/2.2.3/descrintro/ -- https://mail.python.org/mailman/listinfo/python-list

Re: exec "x = 3; print x" in a - How does it work?

2016-03-08 Thread Ben Finney
"Veek. M" writes: > What is the return value of `exec`? You can refer to the documentation for questions like that. https://docs.python.org/3/library/functions.html#exec> > Would that object be then used to iterate the sequence in 'a'? The ‘for’ or ‘while’ statements are correct for iteration.

Re: exec "x = 3; print x" in a - How does it work?

2016-03-08 Thread Steven D'Aprano
On Wednesday 09 March 2016 16:27, Veek. M wrote: > What is the return value of `exec`? Would that object be then used to > iterate the sequence in 'a'? I'm reading this: > https://www.python.org/download/releases/2.2.3/descrintro/ exec is a statement, not a function, so it doesn't have a return

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-08 Thread Marko Rauhamaa
Steven D'Aprano : > Possibly a really amateurish, lazy job, but still done. > > [...] Brilliant! I love helpful tools like that! > > How many years did you say you have been programming? Let's keep it civil, please. Marko -- https://mail.python.org/mailman/listinfo/python-list

Re: exec "x = 3; print x" in a - How does it work?

2016-03-08 Thread Veek. M
Ben Finney wrote: > "Veek. M" writes: > >> What is the return value of `exec`? > > You can refer to the documentation for questions like that. > https://docs.python.org/3/library/functions.html#exec> > >> Would that object be then used to iterate the sequence in 'a'? > > The ‘for’ or ‘while’

Re: exec "x = 3; print x" in a - How does it work?

2016-03-08 Thread Veek. M
Steven D'Aprano wrote: > On Wednesday 09 March 2016 16:27, Veek. M wrote: > >> What is the return value of `exec`? Would that object be then used to >> iterate the sequence in 'a'? I'm reading this: >> https://www.python.org/download/releases/2.2.3/descrintro/ > > > exec is a statement, not a f

Re: exec "x = 3; print x" in a - How does it work?

2016-03-08 Thread Chris Angelico
On Wed, Mar 9, 2016 at 5:25 PM, Veek. M wrote: > ah, okay - i'm familiar with the py3 syntax where you do: > eval('whatever stmt', globals={}, locals={}) > I suppose this: exec " " in NS; syntax is strictly py2? > > Many thanks :) Yeah, that's one of the things that was cleaned up in Py3. Several

Python path

2016-03-08 Thread ast
Hello Python path may be read with: import sys sys.path There is an environnement variable $PYTHONPATH (windows) to set if you want to add some additionnal directories to the path. But the default path seems not to be stored in any environnement variable. Is it correct ? Is it stored somewhe

turtle ??

2016-03-08 Thread Ömer sarı
hi , l would like to ask a question as l m a little bit confused .l do practice in "how to think like a computer scientist:learning with python3.l installed python 2.7.10 and upper version 3.5 python.when l run example code in the book , it gave me error.you can find the code , below. "" impor

Re: Review Request of Python Code

2016-03-08 Thread INADA Naoki
While MySQL doesn't have server side cursor, MySQLdb has SSCursor class. https://github.com/PyMySQL/mysqlclient-python/blob/master/MySQLdb/cursors.py#L551 Default cursor fetches MySQL response at once and convert them into Python object. SSCursor fetches MySQL response row by row. So it saves Pyt