python - handling HTTP requests asynchronously

2016-05-06 Thread lordluke80
Hi everyone, I need to generate a PDF report for each entry of a django queryset. There'll be between between 30k and 40k entries. The PDF is generated through an external API. Since currently is generated on demand, this is handled synchronously via an HTTP request/response. That will be diff

Re: Whittle it on down

2016-05-06 Thread Peter Otten
DFS wrote: > On 5/5/2016 1:39 AM, Stephen Hansen wrote: > >> Given: >> > input = [u'Espa\xf1ol', 'Health & Fitness Clubs (36)', 'Health Clubs & > Gymnasiums (42)', 'Health Fitness Clubs', 'Name', 'Atlanta city > guide', 'edit address', 'Tweet', 'PHYSICAL FITNESS CONSULTANTS & > TR

Re: After a year using Node.js, the prodigal son returns

2016-05-06 Thread Gregory Ewing
Chris Angelico wrote: https://www.destroyallsoftware.com/talks/the-birth-and-death-of-javascript This video seems to be broken. It stops about 1/3 of the way through for me and says "No video with supported format and MIME type found". -- Greg -- https://mail.python.org/mailman/listinfo/pytho

Re: After a year using Node.js, the prodigal son returns

2016-05-06 Thread Chris Angelico
On Fri, May 6, 2016 at 6:51 PM, Gregory Ewing wrote: > Chris Angelico wrote: > >> https://www.destroyallsoftware.com/talks/the-birth-and-death-of-javascript > > > This video seems to be broken. It stops about 1/3 of the way > through for me and says "No video with supported format and > MIME type

Re: Whittle it on down

2016-05-06 Thread alister
On Thu, 05 May 2016 19:31:33 -0400, DFS wrote: > On 5/5/2016 1:39 AM, Stephen Hansen wrote: > >> Given: >> > input = [u'Espa\xf1ol', 'Health & Fitness Clubs (36)', 'Health Clubs > & Gymnasiums (42)', 'Health Fitness Clubs', 'Name', 'Atlanta city > guide', 'edit address', 'Tweet', 'PHY

Re: Pylint prefers list comprehension over filter...

2016-05-06 Thread Steven D'Aprano
On Fri, 6 May 2016 12:57 pm, Stephen Hansen wrote: > On Thu, May 5, 2016, at 07:46 PM, Dan Sommers wrote: >> On Thu, 05 May 2016 18:37:11 -0700, Stephen Hansen wrote: >> >> > ''.join(x for x in string if x.isupper()) >> >> > The difference is, both filter and your list comprehension *build a

Re: python, ctypes and GetIconInfo issue

2016-05-06 Thread mymyxin
Hello eryk sun, first of all thank you very much, really appreciate your help. Please be informed that I'm a python beginner, so forgive me if my following questions sound stupid (also I'm not a native speaker). > Please avoid windll. It caches the loaded library, which in turn > caches function

Re: After a year using Node.js, the prodigal son returns

2016-05-06 Thread Grant Edwards
On 2016-05-06, Chris Angelico wrote: > On Fri, May 6, 2016 at 12:49 PM, Michael Torrie wrote: >> On 05/04/2016 02:59 AM, Steven D'Aprano wrote: >>> A year ago, Gavin Vickery decided to move away from Python and give >>> Javascript with Node.js a try. Twelve months later, he has written about his

Re: After a year using Node.js, the prodigal son returns

2016-05-06 Thread Chris Angelico
On Fri, May 6, 2016 at 11:45 PM, Grant Edwards wrote: >> JavaScript is terrible. Really, really bad. And because of that, it >> has the potential to sweep the world. > > If your reasoning is correct, it'll never be able to overtake PHP. > > I've never written anything over a hundred or two lines i

Re: Whittle it on down

2016-05-06 Thread DFS
On 5/6/2016 3:45 AM, Peter Otten wrote: DFS wrote: Should've looked earlier. Their master list of categories http://www.usdirectory.com/cat/g0 shows a few commas, a bunch of dashes, and the ampersands we talked about. "OFFICE SERVICES, SUPPLIES & EQUIPMENT" gets removed because of the comma.

Slight problems with python in Windows

2016-05-06 Thread Peter Toye
I'm trying to install Python under Windows 7 so that I can use git-review and have found a few niggling issues. 1) Apparently (according to the git-review pages) pip has a problem with directories with spaces in their names. Python's default installation directory is under Program Files. I agre

Re: Whittle it on down

2016-05-06 Thread DFS
On 5/6/2016 9:58 AM, DFS wrote: On 5/6/2016 3:45 AM, Peter Otten wrote: DFS wrote: Should've looked earlier. Their master list of categories http://www.usdirectory.com/cat/g0 shows a few commas, a bunch of dashes, and the ampersands we talked about. "OFFICE SERVICES, SUPPLIES & EQUIPMENT" g

Re: python, ctypes and GetIconInfo issue

2016-05-06 Thread mymyxin
A further question if you don't mind. In your example you used a base class and ICONINFO well as ICONINFOEX inherit it. As the members of ICONINFO are part of ICONINFOEX couldn't we do something like class ICONINFO_BASE(ctypes.Structure): def __del__(self, ): if self.hbmMask:

Re: python - handling HTTP requests asynchronously

2016-05-06 Thread justin walters
On Thu, May 5, 2016 at 11:56 PM, wrote: > Hi everyone, > I need to generate a PDF report for each entry of a django queryset. > There'll be between between 30k and 40k entries. > > The PDF is generated through an external API. Since currently is generated > on demand, this is handled synchronousl

Re: Whittle it on down

2016-05-06 Thread Peter Otten
DFS wrote: > There are up to 4 levels of categorization: > http://www.usdirectory.com/cat/g0 shows 21 Level 1 categories, and 390 > Level 2. To get the Level 3 and 4 you have to drill-down using the > hyperlinks. > > How to do it in python code is beyond my skills at this point. Get the > hre

Re: Slight problems with python in Windows

2016-05-06 Thread Pertti Kosunen
On 6.5.2016 14:22, Peter Toye wrote: I'm trying to install Python under Windows 7 so that I can use git-review and have found a few niggling issues. 1) Apparently (according to the git-review pages) pip has a problem with directories with spaces in their names. Python's default installation di

Re: Slight problems with python in Windows

2016-05-06 Thread Zachary Ware
Hi Peter, On Fri, May 6, 2016 at 6:22 AM, Peter Toye wrote: > I'm trying to install Python under Windows 7 so that I can use git-review and > have found a few niggling issues. > > 1) Apparently (according to the git-review pages) pip has a problem with > directories with spaces in their names.

Re: After a year using Node.js, the prodigal son returns

2016-05-06 Thread Rustom Mody
On Friday, May 6, 2016 at 8:23:27 AM UTC+5:30, Chris Angelico wrote: > On Fri, May 6, 2016 at 12:49 PM, Michael Torrie wrote: > > On 05/04/2016 02:59 AM, Steven D'Aprano wrote > >> A year ago, Gavin Vickery decided to move away from Python and give > >> Javascript with Node.js a try. Twelve months

A fun python CLI program for all to enjoy!

2016-05-06 Thread DFS
getAddresses.py Scrapes addresses from www.usdirectory.com and stores them in a SQLite database, or writes them to text files for mailing labels, etc Now, just by typing 'fast food Taco Bell 10 db all' you can find out how many Taco Bells are within 10 miles of you, and store all the addres

Re: A fun python CLI program for all to enjoy!

2016-05-06 Thread MRAB
On 2016-05-06 20:10, DFS wrote: getAddresses.py Scrapes addresses from www.usdirectory.com and stores them in a SQLite database, or writes them to text files for mailing labels, etc Now, just by typing 'fast food Taco Bell 10 db all' you can find out how many Taco Bells are within 10 miles of

Re: Python is an Equal Opportunity Programming Language

2016-05-06 Thread beliavsky--- via Python-list
On Thursday, May 5, 2016 at 3:00:01 PM UTC-4, Terry Reedy wrote: > https://motherboard.vice.com/blog/python-is-an-equal-opportunity-programming-language > > from an 'Intel(R) Software Evangelist' > -- > Terry Jan Reedy >From the link: MB: What is it about Python that makes it friendly to women?

Re: Python is an Equal Opportunity Programming Language

2016-05-06 Thread Ethan Furman
On 05/06/2016 01:35 PM, beliavsky--- via Python-list wrote: Most of [Guido's] keynote at that conference was answering questions from > the people who had attended. And he actually said, "Let's alternate between > men and women asking questions."On the second day of the conference, he was > we

Re: Python is an Equal Opportunity Programming Language

2016-05-06 Thread beliavsky--- via Python-list
On Friday, May 6, 2016 at 5:07:28 PM UTC-4, Ethan Furman wrote: > On 05/06/2016 01:35 PM, beliavsky--- via Python-list wrote: > > > Most of [Guido's] keynote at that conference was answering questions from > > the people who had attended. And he actually said, "Let's alternate > between > > men

Re: Python is an Equal Opportunity Programming Language

2016-05-06 Thread alex wright
It seems like it would be equal opportunity between sexes. 1:1 opportunity to ask based on apparent sex. It is not equal representation necessarily. On May 6, 2016 5:53 PM, "beliavsky--- via Python-list" < python-list@python.org> wrote: > On Friday, May 6, 2016 at 5:07:28 PM UTC-4, Ethan Furman

Re: Whittle it on down

2016-05-06 Thread DFS
On 5/6/2016 11:44 AM, Peter Otten wrote: DFS wrote: There are up to 4 levels of categorization: http://www.usdirectory.com/cat/g0 shows 21 Level 1 categories, and 390 Level 2. To get the Level 3 and 4 you have to drill-down using the hyperlinks. How to do it in python code is beyond my ski

Re: A fun python CLI program for all to enjoy!

2016-05-06 Thread DFS
On 5/6/2016 4:30 PM, MRAB wrote: On 2016-05-06 20:10, DFS wrote: getAddresses.py Scrapes addresses from www.usdirectory.com and stores them in a SQLite database, or writes them to text files for mailing labels, etc Now, just by typing 'fast food Taco Bell 10 db all' you can find out how many

Re: A fun python CLI program for all to enjoy!

2016-05-06 Thread Ethan Furman
On 05/06/2016 04:12 PM, DFS wrote: On 5/6/2016 4:30 PM, MRAB wrote: If you don't want to use the 'with' statement, note that closing the file is: f.close() It needs the "()"! I used close() in 1 place, but close without parens in 2 other places. So it works either way. Go

Re: python, ctypes and GetIconInfo issue

2016-05-06 Thread eryk sun
On Fri, May 6, 2016 at 9:49 AM, wrote: > > In your example you used a base class > and ICONINFO well as ICONINFOEX inherit it. > As the members of ICONINFO are part of ICONINFOEX > couldn't we do something like > > class ICONINFO_BASE(ctypes.Structure): > def __del__(self, ): > if sel

Re: python, ctypes and GetIconInfo issue

2016-05-06 Thread eryk sun
On Fri, May 6, 2016 at 8:36 AM, wrote: > >> Please avoid windll. It caches the loaded library, which in turn >> caches function pointers. So all packages that use windll.user32 are >> potentially stepping on each others' toes with mutually incompatible >> function prototypes. It also doesn't allo

Re: A fun python CLI program for all to enjoy!

2016-05-06 Thread DFS
On 5/6/2016 7:29 PM, Ethan Furman wrote: On 05/06/2016 04:12 PM, DFS wrote: On 5/6/2016 4:30 PM, MRAB wrote: If you don't want to use the 'with' statement, note that closing the file is: f.close() It needs the "()"! I used close() in 1 place, but close without parens in 2

Re: A fun python CLI program for all to enjoy!

2016-05-06 Thread MRAB
On 2016-05-07 00:58, DFS wrote: On 5/6/2016 7:29 PM, Ethan Furman wrote: On 05/06/2016 04:12 PM, DFS wrote: On 5/6/2016 4:30 PM, MRAB wrote: If you don't want to use the 'with' statement, note that closing the file is: f.close() It needs the "()"! I used close() in 1 pla

Re: Python is an Equal Opportunity Programming Language

2016-05-06 Thread Steven D'Aprano
On Sat, 7 May 2016 06:35 am, beliav...@aol.com wrote: > This not "equal opportunity". It is a quota system. I must ask, what do you think the phrase "quota system" means? Who is setting and enforcing this quota, and given that only about 1 in 20 Python programmers is a woman, do you think men ar

Re: Python is an Equal Opportunity Programming Language

2016-05-06 Thread Chris Angelico
On Sat, May 7, 2016 at 1:33 PM, Steven D'Aprano wrote: > On Sat, 7 May 2016 06:35 am, beliav...@aol.com wrote: > >> This not "equal opportunity". It is a quota system. > > I must ask, what do you think the phrase "quota system" means? > > Who is setting and enforcing this quota, and given that onl

Re: Python is an Equal Opportunity Programming Language

2016-05-06 Thread John Wong
On Sat, May 7, 2016 at 12:04 AM, Chris Angelico wrote: > > > In the case of PyCon questions, I fully agree with it; there were > enough women present that it wasn't a ridiculous suggestion, and it > encourages people to speak up who might otherwise have kept quiet. But > just because that worked w

Re: A fun python CLI program for all to enjoy!

2016-05-06 Thread Stephen Hansen
On Fri, May 6, 2016, at 04:58 PM, DFS wrote: > Improper f.close didn't seem to affect any of the files my program wrote > - and I checked a lot of them when I was writing the code. To be clear, its not an "improper" f.close. That command is simply not closing the file. Period. "f.close" is how yo

Re: A fun python CLI program for all to enjoy!

2016-05-06 Thread Gregory Ewing
DFS wrote: Maybe it worked because the last time the file was written to was in a for loop, so I got lucky and the files weren't truncated? Don't know. It "works" because CPython disposes of objects as soon as they are not referenced anywhere. Other implementations of Python (e.g. Jython, PyPy

Why do these statements evaluate the way they do?

2016-05-06 Thread Anthony Papillion
I'm trying to figure out why the following statements evaluate the way they do and I'm not grasping it for some reason. I'm hoping someone can help me. 40+2 is 42 #evaluates to True But 2**32 is 2**32 #evaluates to False This is an example taken from a Microsoft blog on the topic. They say the

Re: Python is an Equal Opportunity Programming Language

2016-05-06 Thread Gregory Ewing
Steven D'Aprano wrote: Who is setting and enforcing this quota, and given that only about 1 in 20 Python programmers is a woman, do you think men are seriously missing out on any opportunities? Suppose there are 100 people wanting to ask questions, and there is only time to answer 10 questions.

Re: Why do these statements evaluate the way they do?

2016-05-06 Thread Chris Angelico
On Sat, May 7, 2016 at 4:36 PM, Anthony Papillion wrote: > I'm trying to figure out why the following statements evaluate the way they > do and I'm not grasping it for some reason. I'm hoping someone can help me. > > 40+2 is 42 #evaluates to True > But > 2**32 is 2**32 #evaluates to False > > Thi