RE: Can json.dumps create multiple lines

2016-12-02 Thread Joaquin Alzola
On Thu, Dec 1, 2016 at 10:30 AM, Cecil Westerhof wrote: > I would prefer when it would generate: > '[ > "An array", > "with several strings", > "as a demo" > ]' > > Is this possible, or do I have to code this myself? > https://docs.python.org/3/library/json.html?highlight=

Re: compile error when using override

2016-12-02 Thread Ho Yeung Lee
from __future__ import division from sympy import * x, y, z, t = symbols('x y z t') k, m, n = symbols('k m n', integer=True) f, g, h = symbols('f g h', cls=Function) class AA(object): @staticmethod def __additionFunction__(a1, a2): return a1*a2 #Put what you want instead of

Re: What do you think: good idea to launch a marketplace on python+django?

2016-12-02 Thread codewizard
On Friday, December 2, 2016 at 2:01:57 AM UTC-5, Gus_G wrote: > Hello, what do you think about building a marketplace website on connection > of python+django? End effect-side should look and work similar to these: > https://zoptamo.com/uk/s-abs-c-uk, https://www.ownerdirect.com/ . What are > yo

Re: correct way to catch exception with Python 'with' statement

2016-12-02 Thread Grant Edwards
On 2016-12-02, Marko Rauhamaa wrote: > Grant Edwards : >> In general CISC processors like x86, AMD64, 68K have read-modify-write >> instructions that allow you to increment a memory location or >> set/clear a bit in memory with a single instruction: >> >> INC.W [R0]# increment memory word

Re: Request Help With Byte/String Problem

2016-12-02 Thread Grant Edwards
On 2016-12-02, Wildman via Python-list wrote: > On Fri, 02 Dec 2016 15:11:18 +, Grant Edwards wrote: > >> I don't know what the "addr" array contains, but if addr is a byte >> string, then the "int()" call is not needed, in Pythong 3, a byte is >> already an integer: >> >> def format_ip(a

Re: correct way to catch exception with Python 'with' statement

2016-12-02 Thread Marko Rauhamaa
Grant Edwards : > In general CISC processors like x86, AMD64, 68K have read-modify-write > instructions that allow you to increment a memory location or > set/clear a bit in memory with a single instruction: > > INC.W [R0]# increment memory word whose addr is in register R0 The x86 instru

Re: correct way to catch exception with Python 'with' statement

2016-12-02 Thread Michael Torrie
On 12/01/2016 08:39 PM, Ned Batchelder wrote: > On Thursday, December 1, 2016 at 7:26:18 PM UTC-5, DFS wrote: >> How is it possible that the 'if' portion runs, then 44/100,000ths of a >> second later my process yields to another process which deletes the >> file, then my process continues. > > A

Re: Request Help With Byte/String Problem

2016-12-02 Thread Wildman via Python-list
On Fri, 02 Dec 2016 15:11:18 +, Grant Edwards wrote: > I don't know what the "addr" array contains, but if addr is a byte > string, then the "int()" call is not needed, in Pythong 3, a byte is > already an integer: > > def format_ip(a): >return '.'.join(str(b) for b in a) > > add

Re: correct way to catch exception with Python 'with' statement

2016-12-02 Thread Grant Edwards
On 2016-12-02, Steve D'Aprano wrote: > I'm not an expert on the low-level hardware details, so I welcome > correction, but I think that you can probably expect that the OS can > interrupt code execution between any two CPU instructions. Yep, mostly. Some CPUs have "lock" features that allow two

Re: Request Help With Byte/String Problem

2016-12-02 Thread Grant Edwards
On 2016-12-02, Wildman via Python-list wrote: > On Wed, 30 Nov 2016 14:39:02 +0200, Anssi Saari wrote: > >> There'll be a couple more issues with the printing but they should be >> easy enough. > > I finally figured it out, I think. I'm not sure if my changes are > what you had in mind but it is

Re: Asyncio -- delayed calculation

2016-12-02 Thread Chris Angelico
On Sat, Dec 3, 2016 at 1:26 AM, Frank Millman wrote: > Then Twisted made a strong case for an asynchronous approach. One of their > claims (which I have no reason to doubt) was that, because each user > 'session' spends most of its time waiting for something - keyboard input, > reply from database

Re: Asyncio -- delayed calculation

2016-12-02 Thread Marko Rauhamaa
"Frank Millman" : > Then Twisted made a strong case for an asynchronous approach. One of > their claims (which I have no reason to doubt) was that, because each > user 'session' spends most of its time waiting for something - > keyboard input, reply from database, etc - their approach allows > hund

Re: Asyncio -- delayed calculation

2016-12-02 Thread Frank Millman
"Steve D'Aprano" wrote in message news:58417e2d$0$1612$c3e8da3$54964...@news.astraweb.com... My first impressions on this is that we have a couple of good models for preemptive parallelism, threads and processes, both of which can do everything that concurrency can do, and more, and both of whi

Re: Asyncio -- delayed calculation

2016-12-02 Thread Marko Rauhamaa
Steve D'Aprano : > py> await x > File "", line 1 > await x > ^ > SyntaxError: invalid syntax "await" is only allowed inside a coroutine. > So why do we need asyncio? What is it actually good for? Asyncio is a form of cooperative multitasking. It presents a framework of "fake thr

Re: Asyncio -- delayed calculation

2016-12-02 Thread Steve D'Aprano
On Thu, 1 Dec 2016 06:53 pm, Christian Gollwitzer wrote: > well that works - but I think it it is possible to explain it, without > actually understanding what it does behind the scences: > > x = foo() > # schedule foo for execution, i.e. put it on a TODO list > > await x > # run the TODO list u