Re: Question about asyncio and blocking operations

2016-01-28 Thread Frank Millman
"Ian Kelly" wrote in message news:CALwzidkr-fT6S6wH2caNaxyQvUdAw=x7xdqkqofnrrwzwnj...@mail.gmail.com... On Wed, Jan 27, 2016 at 10:14 AM, Ian Kelly wrote: > Unfortunately this doesn't actually work at present. > EventLoop.run_in_executor swallows the StopIteration exception and > just returns

Re: Question about asyncio and blocking operations

2016-01-28 Thread Chris Angelico
On Thu, Jan 28, 2016 at 10:11 PM, Frank Millman wrote: >> >> The other risk is that the wrong result will be queried (two async >> tasks put something onto the queue - which one gets the first >> result?), which could either be coped with by simple sequencing (maybe >> this happens automatically,

Re: Question about asyncio and blocking operations

2016-01-28 Thread Chris Angelico
On Thu, Jan 28, 2016 at 8:13 PM, Frank Millman wrote: > Run the database handler in a separate thread. Use a queue.Queue to send > requests to the handler. Use an asyncio.Queue to send results back to the > caller, which can call 'await q.get()'. > > I ran a quick test and it seems to work. What d

Re: Question about asyncio and blocking operations

2016-01-28 Thread Frank Millman
"Chris Angelico" wrote in message news:captjjmr162+k4lzefpxrur6wxrhxbr-_wkrclldyr7kst+k...@mail.gmail.com... On Thu, Jan 28, 2016 at 8:13 PM, Frank Millman wrote: > Run the database handler in a separate thread. Use a queue.Queue to send > requests to the handler. Use an asyncio.Queue to send

class attribute

2016-01-28 Thread ast
hello Here is a class from django framework from django.db import models class Article(models.Model): titre = models.CharField(max_length=100) auteur = models.CharField(max_length=42) contenu = models.TextField(null=True) date = models.DateTimeField(auto_now_add=True, auto_now=Fal

Re: class attribute

2016-01-28 Thread jmp
On 01/28/2016 02:15 PM, ast wrote: hello Here is a class from django framework from django.db import models class Article(models.Model): titre = models.CharField(max_length=100) auteur = models.CharField(max_length=42) contenu = models.TextField(null=True) date = models.DateT

Re: class attribute

2016-01-28 Thread ast
"ast" a écrit dans le message de news:56aa1474$0$27833$426a7...@news.free.fr... OK, thank you for answer I didn't studied metaclass yet that's why it is not clear for me. I have to take a look at that concept first -- https://mail.python.org/mailman/listinfo/python-list

Re: class attribute

2016-01-28 Thread Chris Angelico
On Fri, Jan 29, 2016 at 12:56 AM, jmp wrote: > My guess is that models.Model has a metclass. Without going too much int > details, the metaclass may change the class structure when it's created. > > django is very specific and very database oriented. > > " > article = Article(titre="Bonjour", aute

installation error

2016-01-28 Thread JAMES SCALF
Hello, I am having an issue installing Python 3.51, I get an error message stating that there is a dll that is missing: API-MS-WIN-CRT-RUNTIME-l1-1-0.DLL I have tried reinstalling the program but keep getting the same error message. Please advise of fix. Please reply to jr

[no subject]

2016-01-28 Thread Karla Larrea
Instalar python -- https://mail.python.org/mailman/listinfo/python-list

Re:

2016-01-28 Thread Joel Goldstick
On Mon, Jan 25, 2016 at 8:58 PM, Karla Larrea < karlamishellkmlp1...@hotmail.com> wrote: > Instalar python > > -- > https://mail.python.org/mailman/listinfo/python-list > So, you are trying to install python? A wild guess. Can you tell us what OS, what version of python, what have you tried so f

Re: how to completely uninstall python 2.7 on Windows

2016-01-28 Thread Joel Goldstick
On Thu, Jan 28, 2016 at 10:40 AM, Ryan Gonzalez wrote: > Wrong mailing list! You probably want > https://mail.python.org/mailman/listinfo/python-list > > Anyway, does uninstalling from the Control Panel not work? > > On January 28, 2016 7:59:00 AM CST, "Shi, Jiajun" > wrote: > >Hi there, > > > >

Re: class attribute

2016-01-28 Thread Todd Dembrey
On 28/01/16 13:15, ast wrote: hello Here is a class from django framework from django.db import models class Article(models.Model): titre = models.CharField(max_length=100) auteur = models.CharField(max_length=42) contenu = models.TextField(null=True) date = models.DateTimeField(

Re: installation error

2016-01-28 Thread Oscar Benjamin
On 27 January 2016 at 15:56, JAMES SCALF wrote: > > I am having an issue installing Python 3.51, > > I get an error message stating that there is a dll that is > missing: > > API-MS-WIN-CRT-RUNTIME-l1-1-0.DLL You need to get this file in a Windows update from Microsoft. I think you can download i

Re: Question about asyncio and blocking operations

2016-01-28 Thread Ian Kelly
On Thu, Jan 28, 2016 at 9:40 AM, Frank Millman wrote: > I have hit a snag. It feels like a bug in 'await q.get()', though I am sure > it is just me misunderstanding how it works. > > I can post some working code if necessary, but here is a short description. > > Here is the database handler - 'req

Re: Python Unit test

2016-01-28 Thread toluagboola
Thanks for the contributions. Took a while but I got the function done. My problem was in the first two lines, I had to import the python file in my test code which I did not do earlier -- https://mail.python.org/mailman/listinfo/python-list

Re: Question about asyncio and blocking operations

2016-01-28 Thread Ian Kelly
On Jan 28, 2016 4:13 AM, "Frank Millman" wrote: > > "Chris Angelico" wrote in message news:captjjmr162+k4lzefpxrur6wxrhxbr-_wkrclldyr7kst+k...@mail.gmail.com... >> >> >> On Thu, Jan 28, 2016 at 8:13 PM, Frank Millman wrote: >> > Run the database handler in a separate thread. Use a queue.Queue to

Re: how to completely uninstall python 2.7 on Windows

2016-01-28 Thread Ryan Gonzalez
Wrong mailing list! You probably want https://mail.python.org/mailman/listinfo/python-list Anyway, does uninstalling from the Control Panel not work? On January 28, 2016 7:59:00 AM CST, "Shi, Jiajun" wrote: >Hi there, > >Please help me to uninstall Python 2.7 on Windows. I want to install >Pyt

Re: class attribute

2016-01-28 Thread Joel Goldstick
On Thu, Jan 28, 2016 at 9:56 AM, Chris Angelico wrote: > On Fri, Jan 29, 2016 at 12:56 AM, jmp wrote: > > My guess is that models.Model has a metclass. Without going too much int > > details, the metaclass may change the class structure when it's created. > > > > django is very specific and very

Re: Question about asyncio and blocking operations

2016-01-28 Thread Frank Millman
"Ian Kelly" wrote in message news:CALwzidnGbz7kM=d7mkua2ta9-csfn9u0ohl0w-x5bbixpcw...@mail.gmail.com... On Jan 28, 2016 4:13 AM, "Frank Millman" wrote: > > I *think* I have this one covered. When the caller makes a request, it creates an instance of an asyncio.Queue, and includes it with the

Warehouse, the new PyPi codebase

2016-01-28 Thread Mark Lawrence
Hi folks, A couple of links for those who may be interested and haven't heard. http://pyfound.blogspot.co.uk/2016/01/welcome-to-warehouse.html http://pyfound.blogspot.co.uk/2016/01/postscript-to-warehouse-post.html -- My fellow Pythonistas, ask not what our language can do for you, ask what you

Re: how to get python version ?

2016-01-28 Thread Rob Gaddi
namenobodywa...@gmail.com wrote: > hi > > is there something analogous to sys.platform that lets you get the version of > python you're using? sorry if the question is too see-spot-run. thanks if you > can help > > peace > stm Since everyone else has answered the question you asked, let me answ

Re: Question about asyncio and blocking operations

2016-01-28 Thread Maxime S
2016-01-28 17:53 GMT+01:00 Ian Kelly : > On Thu, Jan 28, 2016 at 9:40 AM, Frank Millman wrote: > > > The caller requests some data from the database like this. > > > >return_queue = asyncio.Queue() > >sql = 'SELECT ...' > >request_queue.put((return_queue, sql)) > > Note that since thi

Re: Question about asyncio and blocking operations

2016-01-28 Thread Ian Kelly
On Thu, Jan 28, 2016 at 2:23 PM, Maxime S wrote: > > 2016-01-28 17:53 GMT+01:00 Ian Kelly : >> >> On Thu, Jan 28, 2016 at 9:40 AM, Frank Millman wrote: >> >> > The caller requests some data from the database like this. >> > >> >return_queue = asyncio.Queue() >> >sql = 'SELECT ...' >> >

Re: Question about asyncio and blocking operations

2016-01-28 Thread Ian Kelly
On Jan 28, 2016 3:07 PM, "Maxime Steisel" wrote: > > But it is a pretty strange idea to call two fetch*() method concurrently anyways. If you want to process rows concurrently and aren't concerned with processing them in order, it may be attractive to create multiple threads / coroutines, pass th

Re: psss...I want to move from Perl to Python

2016-01-28 Thread Nathan Hilterbrand
On 01/28/2016 07:01 PM, Fillmore wrote: I learned myself Perl as a scripting language over two decades ago. All through this time, I would revert to it from time to time whenever I needed some text manipulation and data analysis script. My problem? maybe I am stupid, but each time I have t

Re: psss...I want to move from Perl to Python

2016-01-28 Thread Cameron Simpson
On 28Jan2016 19:01, Fillmore wrote: I learned myself Perl as a scripting language over two decades ago. All through this time, I would revert to it from time to time whenever I needed some text manipulation and data analysis script. My problem? maybe I am stupid, but each time I have to go b

psss...I want to move from Perl to Python

2016-01-28 Thread Fillmore
I learned myself Perl as a scripting language over two decades ago. All through this time, I would revert to it from time to time whenever I needed some text manipulation and data analysis script. My problem? maybe I am stupid, but each time I have to go back and re-learn the syntax, the got

Re: psss...I want to move from Perl to Python

2016-01-28 Thread Paul Rubin
Fillmore writes: > I look and Python and it looks so much more clean Yes it is, I forgot everything I knew about Perl shortly after starting to use Python. > add to that that it is the language of choice of data miners... There are a bunch of statistical libraries and that sort of thing but

Re: psss...I want to move from Perl to Python

2016-01-28 Thread paul . hermeneutic
On Thu, Jan 28, 2016 at 5:01 PM, Fillmore wrote: > > I learned myself Perl as a scripting language over two decades ago. All > through this time, I would revert to it from time to time whenever I needed > some text manipulation and data analysis script. > > My problem? maybe I am stupid, but each

Re: psss...I want to move from Perl to Python

2016-01-28 Thread Chris Angelico
On Fri, Jan 29, 2016 at 1:06 PM, Paul Rubin wrote: > Fillmore writes: >> I look and Python and it looks so much more clean > > Yes it is, I forgot everything I knew about Perl shortly after starting > to use Python. https://xkcd.com/353/ Particularly the hover text. :) ChrisA -- https://m

Re: psss...I want to move from Perl to Python

2016-01-28 Thread Chris Angelico
On Fri, Jan 29, 2016 at 11:01 AM, Fillmore wrote: > Does Python have Regexps? Yes! Although there are often other ways of doing things, so you don't *have* to use a regex for everything. But yes, Python has a powerful regular expression library. > How was the Python 2.7 vs Python 3.X solved? whi

Re: psss...I want to move from Perl to Python

2016-01-28 Thread Chris Angelico
On Fri, Jan 29, 2016 at 2:23 PM, Rick Johnson wrote: > On Thursday, January 28, 2016 at 6:28:25 PM UTC-6, Nathan Hilterbrand wrote: >> Python 2 vs python 3 is anything but "solved". You will hear arguments >> in favor of both. I will not make a suggestion, because I do not have >> on my flame-re

Re: Question about asyncio and blocking operations

2016-01-28 Thread Frank Millman
"Ian Kelly" wrote in message news:calwzidn6nft_o0cfhw1itwja81+mw3schuecadvcen3ix6z...@mail.gmail.com... As I commented in my previous message, asyncio.Queue is not thread-safe, so it's very important that the put calls here be done on the event loop thread using event_loop.call_soon_threadsafe.

Re: psss...I want to move from Perl to Python

2016-01-28 Thread Rick Johnson
On Thursday, January 28, 2016 at 6:28:25 PM UTC-6, Nathan Hilterbrand wrote: > Python 2 vs python 3 is anything but "solved". You will hear arguments > in favor of both. I will not make a suggestion, because I do not have > on my flame-resistant clothing Indeed. About the only subject more vol

Python Scraps, Napkins & Nuggets

2016-01-28 Thread Sayth Renshaw
Hi This may seem an odd request, however i thought i would ask do you have any diagrams, scribbles, presentations you have done when coaching someone at work that just seems to work for others consistently? In coaching non programming topics at work i have noticed the variance in learning styl

Re: psss...I want to move from Perl to Python

2016-01-28 Thread Michael Torrie
On 01/28/2016 07:34 PM, Chris Angelico wrote: > On Fri, Jan 29, 2016 at 1:06 PM, Paul Rubin wrote: >> Fillmore writes: >>> I look and Python and it looks so much more clean >> >> Yes it is, I forgot everything I knew about Perl shortly after starting >> to use Python. > > https://xkcd.com/35

Re: psss...I want to move from Perl to Python

2016-01-28 Thread Steven D'Aprano
On Fri, 29 Jan 2016 11:25 am, Chris Angelico wrote: > Probably the biggest thing to take note of is the Python object model > - how names and objects and assignment work. It's pretty > straight-forward, but if it's not what you're used to, you'll need to > get your head around it. Here's a good ta

Re: >>> %matplotlib inline results in SyntaxError: invalid syntax

2016-01-28 Thread Chris Angelico
On Fri, Jan 29, 2016 at 6:04 PM, Mike S via Python-list wrote: > > I get an error on the last line. I am running this code in Idle Python 3.4.4 > Shell... > > Python 3.4.4 (v3.4.4:737efcadf5a6, Dec 20 2015, 19:28:18) [MSC v.1600 32 bit > (Intel)] on win32 > Type "copyright", "credits" or "license(