Re: stackoverflow and c.l.py (was: GIL switch interval)

2011-09-14 Thread Duncan Booth
Roy Smith  wrote:

> In article ,
>  Duncan Booth  wrote:
> 
>> If you want an answer to how to get a specific bit of code to work then 
>> Stackoverflow is better if only because people can see who has already 
>> answered so don't need to waste time re-answering every trivial little 
>> question about syntax.
> 
> Any halfway decent newsreader application will follow threading and put 
> all the responses to a given question in one place.  Of course, this is 
> a relatively new feature.  If your newsreader is any older than about 
> the mid 1980's, it may not be able to do this.
> 
Sorry, I evidently didn't make myself clear. On Usenet it could be hours 
before your local server updates with other posts on the thread, on 
Stackoverflow the answers will update live as they are posted.

-- 
Duncan Booth http://kupuguy.blogspot.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: stackoverflow and c.l.py (was: GIL switch interval)

2011-09-14 Thread Roy Smith
In article ,
 Duncan Booth  wrote:

> If you want an answer to how to get a specific bit of code to work then 
> Stackoverflow is better if only because people can see who has already 
> answered so don't need to waste time re-answering every trivial little 
> question about syntax.

Any halfway decent newsreader application will follow threading and put 
all the responses to a given question in one place.  Of course, this is 
a relatively new feature.  If your newsreader is any older than about 
the mid 1980's, it may not be able to do this.

In article ,
 Stefan Behnel  wrote:

> I wonder why people ask this kind of question on stackoverflow, and then 
> come here asking people to go over there, read the question, and 
> (potentially) provide an answer.

If you ask here you will probably get the correct answer to your 
question (along with some deep dives into related topics, which are 
often more valuable than the original answer).  If you ask on SO, you 
may also get the correct answer, but in addition you will earn SO karma 
points.  Maybe even some neat badge.  I guess it all depends on what 
your goal is.

Obligatory GIL comment -- I wrote some code the other day that used 4 
threads to perform 4 I/O bound operations (fetching 4 jpegs in parallel 
over http).  I figured the fact that they were I/O bound would avoid any 
GIL problems.  I was shocked and dismayed, however, to find that the 4 
operations all got serialized.  I guess I really didn't understand how 
the GIL worked after all.

So, I rewrote it to use the multiprocessing module.  Egads, still 
serialized!  To make a long story short, it turns out we were using some 
crappy consumer-grade Linksys box as our DNS server, and *it* was single 
threaded.  My 4 threads were blocking on name resolution!

We moved to using a real nameserver, and I converted the code back to 
using threading.  Works like a charm now.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: stackoverflow and c.l.py (was: GIL switch interval)

2011-09-14 Thread Duncan Booth
Stefan Behnel  wrote:

> Matt Joiner, 14.09.2011 04:23:
>> i'm curious as to what can be done with (and handled better) by
>> adjusting sys.setswitchinterval
>> i've opened a question on SO for this, that people might find of
>> interest: http://stackoverflow.com[...]
> 
> I wonder why people ask this kind of question on stackoverflow, and
> then come here asking people to go over there, read the question, and 
> (potentially) provide an answer.
> 
> IMHO, c.l.py is a much better place to ask Python(-related) questions
> than stackoverflow. It's also a much better place to search for an
> answer that is already available in the archives.
> 
If you want an answer to how to get a specific bit of code to work then 
Stackoverflow is better if only because people can see who has already 
answered so don't need to waste time re-answering every trivial little 
question about syntax.

Also there's a theory that people can search for existing answers so only 
one person in the class has to ask how to do their homework. I've never 
actually asked a question on Stackoverflow but I have found the answers to 
a lot of problems I've had.

If you want an open-ended discussion then c.l.py is the place to go. On 
Stackoverflow you would likely just have the question closed pdq.

-- 
Duncan Booth http://kupuguy.blogspot.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: stackoverflow and c.l.py (was: GIL switch interval)

2011-09-13 Thread Steven D'Aprano
On Wed, 14 Sep 2011 02:12 pm Stefan Behnel wrote:

> Matt Joiner, 14.09.2011 04:23:
>> i'm curious as to what can be done with (and handled better) by
>> adjusting sys.setswitchinterval
>> i've opened a question on SO for this, that people might find of
>> interest: http://stackoverflow.com[...]
> 
> I wonder why people ask this kind of question on stackoverflow, and then
> come here asking people to go over there, read the question, and
> (potentially) provide an answer.

You should post that question on stackoverflow, and ask them to reply here.



-- 
Steven

-- 
http://mail.python.org/mailman/listinfo/python-list