On Tue, 11 Mar 2014 23:25:19 -0400, Terry Reedy wrote:
> On 3/11/2014 10:01 PM, Rick Johnson wrote:
>>
>> On Thursday, February 27, 2014 4:18:01 PM UTC-6, Ian wrote:
>>> x += y is meant to be equivalent, except possibly in-place and more
>>> efficient, than x = x + y.
>
> The manual actually says
On 3/11/2014 6:13 PM, John Gordon wrote:
In Ethan Furman
writes:
if missing:
raise ValueError('invoices %r missing from batch' % missing)
It's been a while since I wrote test cases, but I recall using the assert*
methods (assertEqual, assertTrue, etc.) instead of ra
On 3/11/2014 10:01 PM, Rick Johnson wrote:
On Thursday, February 27, 2014 4:18:01 PM UTC-6, Ian wrote:
x += y is meant to be equivalent, except possibly in-place and
more efficient, than x = x + y.
The manual actually says "An augmented assignment expression like x += 1
can be rewritten as x
On 03/06/2014 02:22 PM, teddyb...@gmail.com wrote:
I am using beautifulsoup to get the title and date of the website.
title is working fine but I am not able to pull the date. Here is the code in
the url:
October 22, 2011
In Python, I am using the following code:
date1 = soup.span.text
data=
On Thursday, February 27, 2014 4:18:01 PM UTC-6, Ian wrote:
> x += y is meant to be equivalent, except possibly in-place and more
> efficient, than x = x + y.
In an ideal world, the speed of these two codes should be the same, of course
i'm "assuming" that most competent language designers wou
On Wed, Mar 12, 2014 at 1:01 PM, Rick Johnson
wrote:
> On Thursday, February 27, 2014 4:18:01 PM UTC-6, Ian wrote:
>> x += y is meant to be equivalent, except possibly in-place and more
>> efficient, than x = x + y.
>
> In an ideal world, the speed of these two codes should be the same, of course
On Wed, Mar 12, 2014 at 10:18 AM, Marko Rauhamaa wrote:
> Chris Angelico :
>
>> What corner cases are there with threads that you don't have with
>> anything else?
>
> There are numerous. Here's one example: deadlocks due to two threads
> taking locks in a different order. The problem crops up nat
On 11/03/2014 8:12 PM, Marko Rauhamaa wrote:
Python should let skilled professionals do their work. Thankfully, for
the most part, it does.
Skilled professionals don't solely rely on the standard library, either.
If you know you need a balanced tree, you'll also know where to find an
implemen
On Tue, 11 Mar 2014 04:28:25 -, Chris Angelico
wrote:
On Tue, Mar 11, 2014 at 2:38 PM, Ian Kelly wrote:
On Mon, Mar 10, 2014 at 7:45 PM, Chris Angelico
wrote:
No no,
I could make this so much better by using the 80x86 "REP MOVSW"
command (or commands, depending on your point of view)
On 5 Mar 2014, at 00:14, Bill wrote:
> Hello:
>
> I can't figure out how to create an instance
> of a python class from 'C++':
>
Why not use pycxx from http://sourceforge.net/projects/cxx/?
This lib does all the heavy lifting for you for both python2 and python3.
Has docs and examples.
Barry
Chris Angelico :
> Yep. Now how is that not a problem when you use some other model, like
> an event loop? The standard methods of avoiding deadlocks (like
> acquiring locks in strict order) work exactly the same for all models,
> and are just as necessary.
I was simply saying that if you can wor
Chris Angelico :
> What corner cases are there with threads that you don't have with
> anything else?
There are numerous. Here's one example: deadlocks due to two threads
taking locks in a different order. The problem crops up naturally with
two intercommunicating classes. It can sometimes be ver
On Tue, Mar 11, 2014 at 10:46 AM, Steven D'Aprano
wrote:
>> There are a number of possible solutions. One possibility would be to
>> copy the Circle as an Ellipse and return the new object instead of
>> mutating it. Then you have the situation where, given a mutable object
>> x that satisfies isi
On 03/11/2014 03:13 PM, John Gordon wrote:
Ethan Furman writes:
if missing:
raise ValueError('invoices %r missing from batch' % missing)
It's been a while since I wrote test cases, but I recall using the assert*
methods (assertEqual, assertTrue, etc.) instead of raisin
On Wed, Mar 12, 2014 at 9:28 AM, Marko Rauhamaa wrote:
> If you can't write your own event loop, you probably can't be trusted
> with any multithreaded code, which has much more baffling corner cases.
I'm not sure about that. Threads are generally easier to handle,
because each one just does some
On 03/11/2014 01:58 PM, Ethan Furman wrote:
Anybody have any ideas?
I suspect the O/S is killing the process. If I manually select the other class to run (which has all successful tests,
so no traceback baggage), it runs normally.
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/pyth
Antoine Pitrou :
> This is the usual assumption that high-level libraries are made of
> useless cruft piled up by careless programmers. But there are actual
> reasons why these frameworks have a significant amount of code, and
> people who decide to ignore those reasons are simply bound to
> reimp
Gregory Ewing :
> It's not "epoll function calls" that the coroutine style is intended
> to replace, it's complex systems of chained callbacks. They're
> supposed to make that kind of logic *easier* to follow. If you haven't
> had that experience, it may be because you've only dealt with simple
>
In Ethan Furman
writes:
> if missing:
> raise ValueError('invoices %r missing from batch' % missing)
It's been a while since I wrote test cases, but I recall using the assert*
methods (assertEqual, assertTrue, etc.) instead of raising exceptions.
Perhaps that's the issue?
Sturla Molden wrote:
Another thing is that co-routines and "yield from" statements just makes it
hard to follow the logic of the program. I still have to convince myself
that a library for transforming epoll function calls into co-routines is
actually useful.
It's not "epoll function calls" tha
Steven D'Aprano wrote:
On Tue, 11 Mar 2014 04:39:39 -0600, Ian Kelly wrote:
On Mon, Mar 10, 2014 at 11:03 PM, Gregory Ewing
>
What's the obvious way
to spell in-place set intersection, for example?
I would expect it to be &=,
That's my point -- once you know the binary operator for
an op
So I finally got enough data and enough of an understanding to write some unit
tests for my code.
These aren't the first unit tests I've written, but the behavior I'm getting is
baffling.
I'm using 2.7.4 and I'm testing some routines which attempt to interpret data from a flat file and create
Antoine Pitrou wrote:
> This is the usual assumption that high-level libraries are made of useless
> cruft piled up by careless programmers.
It often is the case, particularly in network programming.
But in this case the programmer is Guido, so it doesn't apply. :)
> What irks me with your r
On Mon, Mar 10, 2014 at 2:38 AM, Marko Rauhamaa wrote:
>> On the whole though I think that the language is not yet mature enough
>> to be able to seriously compete with more established languages like
>> Python or Java.
>
> Also, is there anything seriously lacking in Python, Java and C?
>
> I was
On 3/11/2014 3:53 AM, Chris Withers wrote:
On 10/03/2014 21:57, Terry Reedy wrote:
I'd like to be able to serve the rest of the web api using a pyramid
wsgi app if possible, and I'd like to be able to write the things that
process requests in and validation out in a synchronous fashion, most
lik
On Wed, Mar 12, 2014 at 5:43 AM, Antoine Pitrou wrote:
> This is the usual assumption that high-level libraries are made of useless
> cruft piled up by careless programmers. But there are actual reasons
> why these frameworks have a significant amount of code, and people who
> decide to ignore tho
Sturla Molden gmail.com> writes:
>
> Antoine Pitrou pitrou.net> wrote:
>
> > Yes, why use a library when you can rewrite it all yourself?
>
> This assumes something equivalent to the library will have to be written.
> But if it can be replaced with something very minimalistic it is just
> bloa
Antoine Pitrou wrote:
> Yes, why use a library when you can rewrite it all yourself?
This assumes something equivalent to the library will have to be written.
But if it can be replaced with something very minimalistic it is just
bloat. I would also like to respond that the select module and pywi
In article ,
Jaiprakash Singh wrote:
> hey i am working on scraping a site , so i am using multi-threading concept.
> i wrote a code based on queue (thread safe) but still my code block out after
> sometime, please help , i have searched a lot but unable to resolve it.
> please help i stuck here
On Wed, Mar 12, 2014 at 3:01 AM, Antoine Pitrou wrote:
> Yes, why use a library when you can rewrite it all yourself?
> Actually, you should probably issue system calls to the kernel directly,
> the libc is overrated (as is portability, I suppose).
It's a trade-off, of course. I am fluent in over
Hi Grant
On Tuesday, 11 March 2014 16:52:18 UTC, Grant Edwards wrote:
[...]
>
> And don't bother with device drivers for the network adapters either.
> Just map their PCI regions in to user-space and twiddle the reigisters
> directly! ;)
>
> [I do that when testing PCI boards with C code, and
On Tuesday, March 11, 2014 9:25:29 AM UTC-7, John Gordon wrote:
>
>
>
>
> Why do you say that 'key=lambda x: x.name.lower' is the correct form? That
>
> returns the str.lower() function object, which is a silly thing to sort
>
> on. Surely you want to sort on the *result* of that function, w
A comprehensive and educational answer, Peter. Thank you.
Josh
--
https://mail.python.org/mailman/listinfo/python-list
On 2014-03-11, Antoine Pitrou wrote:
> Sturla Molden gmail.com> writes:
>>
>> Chris Withers simplistix.co.uk> wrote:
>> > Hi All,
>> >
>> > I see python now has a plethora of async frameworks and I need to try
>> > and pick one to use from:
>> >
>> > - asyncio/tulip
>> > - tornado
>> > - twi
On Tue, 11 Mar 2014 04:39:39 -0600, Ian Kelly wrote:
> On Mon, Mar 10, 2014 at 11:03 PM, Gregory Ewing
> wrote:
>> As far as observable effects are concerned, it's quite clear: mutable
>> objects can *always* be updated in-place, and immutable objects can
>> *never* be.
>
> Hm. Consider the circ
Josh English wrote:
> I am running into a strange behavior using the sorted function in Python
> print list(sorted(all_the_stuff, key=lambda x: x.name.lower))
> print list(sorted(all_the_stuff, key=lambda x: x.name.lower()))
Let's simplify your example some more:
>>> items = ["B", "2", "a"]
>>>
In <058a4a9e-7893-44ef-97c0-999a3589e...@googlegroups.com> Josh English
writes:
> print list(sorted(all_the_stuff, key=lambda x: x.name.lower))
> print list(sorted(all_the_stuff, key=lambda x: x.name.lower()))
> # END
> The output is:
> [Thing d, Thing f, Thing 2, Thing a, Thing b, Thing C]
>
On 03/11/2014 09:13 AM, Josh English wrote:
I am running into a strange behavior using the sorted function in Python 2.7.
The key parameter is not behaving as the docs say it does:
Here is a snippet of code, simplified from my full program:
#begin code
class Thing(object):
def __init__(se
On Tue, Mar 11, 2014 at 9:13 AM, Josh English wrote:
> print list(sorted(all_the_stuff, key=lambda x: x.name.lower))
>
In this case, the key being sorted on is the function object x.name.lower,
not the result of the call.
It might make more sense if you break the lambda out into a separate def
s
On Tue, Mar 11, 2014 at 11:17 AM, Sturla Molden wrote:
> Chris Withers wrote:
> > Hi All,
> >
> > I see python now has a plethora of async frameworks and I need to try
> > and pick one to use from:
> >
> > - asyncio/tulip
> > - tornado
> > - twisted
>
> Looking at Tornado's examples on the web I
I am running into a strange behavior using the sorted function in Python 2.7.
The key parameter is not behaving as the docs say it does:
Here is a snippet of code, simplified from my full program:
#begin code
class Thing(object):
def __init__(self, name):
self.name = name
def __
Sturla Molden gmail.com> writes:
>
> Chris Withers simplistix.co.uk> wrote:
> > Hi All,
> >
> > I see python now has a plethora of async frameworks and I need to try
> > and pick one to use from:
> >
> > - asyncio/tulip
> > - tornado
> > - twisted
>
> I'd go for using iocp, epoll and kqueue/
Chris Withers simplistix.co.uk> writes:
>
> The protocols are all financial (do we really not have a pure-python FIX
> library?!) but none are likely to have existing python implementations.
If you are mostly writing protocol implementations (aka parsers and
serializers), then you should consid
On 2014-03-10, flebber wrote:
> I was wondering if a better programmer than I could explain if
> the removal of OO features in golang really does offer an great
> benefit over python.
>
> An article I was reading ran through a brief overview of golang
> in respect of OO features
> http://areyoufuc
On 2014-03-10, Marko Rauhamaa wrote:
> "Brunick, Gerard:(Constellation)" :
>
>> class Test(object):
>> x = 10
>>
>> def __init__(self):
>> self.y = x
>>
>> t = Test()
>> ---
>>
>> raises
>>
>> NameError: global name 'x' is not defined.
>
> In the snippet, x is neither local to __in
On 11 March 2014 11:54, Marko Rauhamaa wrote:
> Ian Kelly :
>
>> eventlet has 115k downloads from PyPI over the last month. gevent has
>> 143k. Twisted has 147k. Tornado has 173k.
>>
>> I'd say that a lot of Python users are already doing non-blocking
>> network I/O, in one form or another.
>
> Th
Ian Kelly :
> eventlet has 115k downloads from PyPI over the last month. gevent has
> 143k. Twisted has 147k. Tornado has 173k.
>
> I'd say that a lot of Python users are already doing non-blocking
> network I/O, in one form or another.
There aren't so many network developers in the world. That m
On Tue, Mar 11, 2014 at 4:58 AM, Marko Rauhamaa wrote:
> Sturla Molden :
>
>> I'd go for using iocp, epoll and kqueue/kevent directly. Why bother to
>> learn a framework? You will find epoll and kqueue/kevent in the select
>> module and iocp in pywin32.
>
> You beat me to it.
>
> However, I'm hopi
Marko Rauhamaa wrote:
> Now, I've taken a brief look at the new asyncio and it looks as if it
> has everything one would hope for (and then some). You'd still need to
> supply the protocol implementations yourself.
Tulip (the new async module) is nice. But I am a bit confused as to how it
combin
Sturla Molden :
> I'd go for using iocp, epoll and kqueue/kevent directly. Why bother to
> learn a framework? You will find epoll and kqueue/kevent in the select
> module and iocp in pywin32.
You beat me to it.
However, I'm hoping asyncio will steer the Python faithful away from
blocking threads
Sturla Molden :
> Looking at Tornado's examples on the web I find this:
>
> [...]
>
> (1) This was written by some Java guys.
I have written several Python async "frameworks" starting from
select.epoll(). It's only a handful of lines of code (plus an AVL tree
implementation for timers). Then, I'
Chris Withers wrote:
> Hi All,
>
> I see python now has a plethora of async frameworks and I need to try
> and pick one to use from:
>
> - asyncio/tulip
> - tornado
> - twisted
I'd go for using iocp, epoll and kqueue/kevent directly. Why bother to
learn a framework? You will find epoll and kqu
On Mon, Mar 10, 2014 at 11:03 PM, Gregory Ewing
wrote:
> As far as observable effects are concerned, it's
> quite clear: mutable objects can *always* be updated
> in-place, and immutable objects can *never* be.
Hm. Consider the circle-ellipse problem. Briefly, a circle is-an
ellipse, so in an in
Chris Withers wrote:
> Hi All,
>
> I see python now has a plethora of async frameworks and I need to try
> and pick one to use from:
>
> - asyncio/tulip
> - tornado
> - twisted
Looking at Tornado's examples on the web I find this:
tornado.ioloop.IOLoop.instance().start()
This single line
Steven D'Aprano :
> On Mon, 10 Mar 2014 19:24:07 -0400, Roy Smith wrote:
>
>> In article <8761nmrnfk@elektro.pacujo.net>,
>> Marko Rauhamaa wrote:
>>
>>> Anyway, this whole debate is rather unnecessary since every developer
>>> is supposed to have both weapons in their arsenal.
>>
>> The p
On Mon, 10 Mar 2014 19:24:07 -0400, Roy Smith wrote:
> In article <8761nmrnfk@elektro.pacujo.net>,
> Marko Rauhamaa wrote:
>
>> Anyway, this whole debate is rather unnecessary since every developer
>> is supposed to have both weapons in their arsenal.
>
> The problem with having a choice i
On Mon, 10 Mar 2014 17:57:19 +0100, Peter Otten wrote:
> Steven D'Aprano wrote:
>> what are my options for *automatically* supplying input to raw_input?
>
> https://pypi.python.org/pypi/mock
>
> In Python 3 this is part of the standard library:
Nice!
Thanks to everyone who responded.
--
On 10/03/2014 21:57, Terry Reedy wrote:
I'd like to be able to serve the rest of the web api using a pyramid
wsgi app if possible, and I'd like to be able to write the things that
process requests in and validation out in a synchronous fashion, most
likely spinning off a thread for each one.
If
Wesley writes:
> Now, I fixed the problem...
>
> Instead of python2.6.6, for python 2.7 it's OK..
>
> Why? gdb does not support python 2.6.6?
gdb supports python 2.6.6 as well (it is a C level debugger with
very few dependencies on Python).
Your reports seem to suggest that your Python 2.6.6 in
Wesley writes:
> ...
> [root@localhost ~]# gdb python
> GNU gdb (GDB) Red Hat Enterprise Linux (7.2-60.el6_4.1)
> This GDB was configured as "x86_64-redhat-linux-gnu".
> Reading symbols from /usr/bin/python...Reading symbols from
> /usr/lib/debug/usr/bin/python2.6.debug...done.
> done.
> (gdb) ru
60 matches
Mail list logo