Re: holding if/else condition in live bitcoin trading Python

2016-08-03 Thread honeygne
On Tuesday, August 2, 2016 at 9:42:03 PM UTC+5:30, Steven D'Aprano wrote: > On Tue, 2 Aug 2016 07:14 pm, Arshpreet Singh wrote: > > > is there any approach I can go with so auto_order_buy() auto_order_sell() > > function only executed once? > > Take them out of the while loop. yes but Bitfinex is

Re: make an object read only

2016-08-03 Thread dieter
Robin Becker writes: > A reportlab user found he was doing the wrong thing by calling canvas.save > repeatedly, our documentation says you should not use Canvas objects after > the > save method has been used. The user had mixed results :( > > It would be better to make the canvas object compl

Re: Why not allow empty code blocks?

2016-08-03 Thread Antoon Pardon
Op 02-08-16 om 14:29 schreef Rustom Mody: > So I was talking of 3 very different levels: > > 1. print x vs print(x) > — a difference too petty for me to waste my time with > > 2. Procedure vs Function as something very necessary for beginner > thinking-ontology which Pascal gets right > > 3. The fa

Re: gmane sending

2016-08-03 Thread Robin Becker
On 03/08/2016 01:24, Ben Finney wrote: Terry Reedy writes: I am reading and sending via gmane right now. ... I also hope not. Hope doesn't fund important infrastructure like Gmane, though; and Lars clearly needs help if Gmane is to thrive https://lwn.net/Articles/695695/>. The sig

Re: Tcl/Tk for Python 3.6.0a3 on Os X 10.9.5

2016-08-03 Thread Christian Gollwitzer
Am 02.08.16 um 22:10 schrieb Ned Deily: "For the initial alpha releases of Python 3.6, the installer is linked with Tcl/Tk 8.5; this will change prior to the beta releases of 3.6.0." Let me also convey some insider information from the Tcl world: the upcoming 8.7 (I'll expect it next year) wil

Re: Tcl/Tk for Python 3.6.0a3 on Os X 10.9.5

2016-08-03 Thread Chris Angelico
On Wed, Aug 3, 2016 at 6:30 PM, Christian Gollwitzer wrote: > Am 02.08.16 um 22:10 schrieb Ned Deily: >> >> "For the initial alpha releases of Python 3.6, the installer is linked >> with Tcl/Tk 8.5; this will change prior to the beta releases of 3.6.0." > > > Let me also convey some insider inform

Re: Why not allow empty code blocks?

2016-08-03 Thread Rustom Mody
On Wednesday, August 3, 2016 at 12:53:02 AM UTC+5:30, Paul Rubin wrote: > Steven D'Aprano writes: > > where power is defined (rather fuzzily) as the expressiveness > > of the language, how easy it is for the programmer to read, write and > > maintain code, how efficient/fast you can implement it,

Re: Debugging (was Re: Why not allow empty code blocks?)

2016-08-03 Thread BartC
On 03/08/2016 06:43, Steven D'Aprano wrote: Not everything that is done is worth the cognitive burden of memorising a special case. In some ways, Python is a more minimalist language than you like. That's okay, you're allowed to disagree with some design decisions. Well it's minimalist

Re: usage of functools.partial in in parallelism

2016-08-03 Thread Sivan Greenberg
So yeah I wanted to remark that I actually identified more with the two questions raised after the 'stop the classes' talk, and I felt much like the two questions that raised after as per documenting design via use of classes in code (However I make sure to keep it all flattened as opposed to the l

Re: Why not allow empty code blocks?

2016-08-03 Thread Steven D'Aprano
On Wednesday 03 August 2016 05:22, Paul Rubin wrote: >> The Halting Problem is easily solved for Bloop languages: they always >> halt. > > If Bloop is powerful enough to "solve the halting problem" as you > describe, that gives it capabilities that Turing-complete languages > lack. (Of course it

Re: Why not allow empty code blocks?

2016-08-03 Thread Rustom Mody
On Wednesday, August 3, 2016 at 1:57:43 PM UTC+5:30, Antoon Pardon wrote: > Op 02-08-16 om 14:29 schreef Rustom Mody: > > So I was talking of 3 very different levels: > > > > 1. print x vs print(x) > > — a difference too petty for me to waste my time with > > > > 2. Procedure vs Function as somethi

Issue with ctypes and callback functions

2016-08-03 Thread Bill Somerville
Hi All, Is this a good place to ask questions about the above? Regards Bill. -- https://mail.python.org/mailman/listinfo/python-list

Re: Why not allow empty code blocks?

2016-08-03 Thread Marko Rauhamaa
Rustom Mody : > So yes scheme are python have similar underbellies but the culture of > use is quite different. I don't know if there's enough Scheme activity out there to call it a culture. As far as underbellies go, Scheme macros and operators are not first-class. The Kernel programming languag

Re: Issue with ctypes and callback functions

2016-08-03 Thread eryk sun
On Wed, Aug 3, 2016 at 9:38 AM, Bill Somerville wrote: > > Is this a good place to ask questions about the above? Discussing ctypes is fine here. There's also a ctypes-users list. -- https://mail.python.org/mailman/listinfo/python-list

Re: Why not allow empty code blocks?

2016-08-03 Thread Rustom Mody
On Wednesday, August 3, 2016 at 5:11:23 PM UTC+5:30, Steven D'Aprano wrote: > On Wednesday 03 August 2016 05:22, Paul Rubin wrote: > > >> The Halting Problem is easily solved for Bloop languages: they always > >> halt. > > > > If Bloop is powerful enough to "solve the halting problem" as you > >

Re: Why not allow empty code blocks?

2016-08-03 Thread Rustom Mody
On Wednesday, August 3, 2016 at 5:39:25 PM UTC+5:30, Marko Rauhamaa wrote: > Rustom Mody : > > So yes scheme are python have similar underbellies but the culture of > > use is quite different. > > I don't know if there's enough Scheme activity out there to call it a > culture. > > As far as under

print() function with encoding= and errors= parameters?

2016-08-03 Thread Malcolm Greene
Looking for a way to use the Python 3 print() function with encoding and errors parameters. Are there any concerns with closing and re-opening sys.stdout so sys.stdout has a specific encoding and errors behavior? Would this break other standard libraries that depend on sys.stdout being configured

Re: Why not allow empty code blocks?

2016-08-03 Thread Rustom Mody
On Wednesday, August 3, 2016 at 5:53:44 PM UTC+5:30, Rustom Mody wrote: > On Wednesday, August 3, 2016 at 5:39:25 PM UTC+5:30, Marko Rauhamaa wrote: > > Rustom Mody : > > I don't know who or what you are referring to. > > I put it in the next line! > > > Scheme for beginning programmers could be

Re: Why not allow empty code blocks?

2016-08-03 Thread Marko Rauhamaa
Rustom Mody : > As I said earlier what they (the MIT profs) seem to be saying is that > the topical relevance of python — a library for making robots — trumps > scheme’s abstract beauty Python is an excellent choice. As far as abstract beauty is concerned, I'm wondering why Python abolished brace

Re: Why not allow empty code blocks?

2016-08-03 Thread Chris Angelico
On Wed, Aug 3, 2016 at 10:16 PM, Rustom Mody wrote: > There he comes waddling in… Your cute-n-cudly strawman!! > A more realistic analogy would be phones > The cellphones we use today often crash > The first nokia I used never crashed but could still run out of battery > And the round-dial landli

Re: Why not allow empty code blocks?

2016-08-03 Thread Marko Rauhamaa
Rustom Mody : > Note: You CAN use python scheme-ishly but few people do that. > eg here is SICP in python with the first examples pure useful powerful > functions: > http://www-inst.eecs.berkeley.edu/~cs61a/sp12/book/functions.html#first-example I see nothing there that is not ordinary Python.

Re: Why not allow empty code blocks?

2016-08-03 Thread Rustom Mody
On Wednesday, August 3, 2016 at 6:08:08 PM UTC+5:30, Marko Rauhamaa wrote: > Rustom Mody : > > > Note: You CAN use python scheme-ishly but few people do that. > > eg here is SICP in python with the first examples pure useful powerful > > functions: > > http://www-inst.eecs.berkeley.edu/~cs61a/sp12

Re: Why not allow empty code blocks?

2016-08-03 Thread BartC
On 03/08/2016 13:36, Chris Angelico wrote: On Wed, Aug 3, 2016 at 10:16 PM, Rustom Mody wrote: There he comes waddling in… Your cute-n-cudly strawman!! A more realistic analogy would be phones The cellphones we use today often crash The first nokia I used never crashed but could still run out

Re: Debugging (was Re: Why not allow empty code blocks?)

2016-08-03 Thread Chris Angelico
On Wed, Aug 3, 2016 at 8:16 PM, BartC wrote: > On 03/08/2016 06:43, Steven D'Aprano wrote: > >> Not everything that is done is worth the cognitive burden of memorising a >> special case. > > > >> In some ways, Python is a more minimalist language than you like. That's >> okay, >> you're allow

Re: Why not allow empty code blocks?

2016-08-03 Thread BartC
On 03/08/2016 09:58, Steven D'Aprano wrote: Python is sometimes described as a Lisp with more sensible syntax, so its not surprising that it is relatively simple to translate Python to Lisp and visa versa. Translating Python would be easier if everything was implemented as Python. But sometim

Re: Why not allow empty code blocks?

2016-08-03 Thread Chris Angelico
On Wed, Aug 3, 2016 at 11:04 PM, BartC wrote: > On 03/08/2016 13:36, Chris Angelico wrote: >> >> On Wed, Aug 3, 2016 at 10:16 PM, Rustom Mody >> wrote: >>> >>> There he comes waddling in… Your cute-n-cudly strawman!! >>> A more realistic analogy would be phones >>> The cellphones we use today of

Re: Why not allow empty code blocks?

2016-08-03 Thread Chris Angelico
On Wed, Aug 3, 2016 at 11:23 PM, BartC wrote: > On 03/08/2016 09:58, Steven D'Aprano wrote: > >> Python is sometimes described as a Lisp with more sensible syntax, so its >> not >> surprising that it is relatively simple to translate Python to Lisp and >> visa >> versa. > > > Translating Python wo

RE: Issue with ctypes and callback functions

2016-08-03 Thread Bill Somerville
-Original Message- From: eryk sun [mailto:eryk...@gmail.com] Sent: 03 August 2016 13:16 To: python-list@python.org Cc: Bill Somerville Subject: Re: Issue with ctypes and callback functions On Wed, Aug 3, 2016 at 9:38 AM, Bill Somerville wrote: > > Is this a good place to ask questions

Re: Why not allow empty code blocks?

2016-08-03 Thread Gordon Levi
"D'Arcy J.M. Cain" wrote: >On Mon, 01 Aug 2016 00:25:58 +1000 >Gordon Levi wrote: >> "D'Arcy J.M. Cain" wrote: >> >I don't care if you are using carrier pigeon. If you send an email >> >address, make it a valid one. >> >> I admire those who use a valid email address on Usenet but it is an >>

Re: Why not allow empty code blocks?

2016-08-03 Thread Grant Edwards
On 2016-08-03, Rustom Mody wrote: > The first nokia I used never crashed but could still run out of > battery And the round-dial landlines of 30 years ago had not even > that problem Yes, technically, it did. Except the batteries were kept elsewhere, and the telco went to a lot of trouble to ma

Re: print() function with encoding= and errors= parameters?

2016-08-03 Thread Random832
On Wed, Aug 3, 2016, at 08:29, Malcolm Greene wrote: > Looking for a way to use the Python 3 print() function with encoding and > errors parameters. > > Are there any concerns with closing and re-opening sys.stdout so > sys.stdout has a specific encoding and errors behavior? Would this break > oth

Re: print() function with encoding= and errors= parameters?

2016-08-03 Thread Peter Otten
Random832 wrote: > On Wed, Aug 3, 2016, at 08:29, Malcolm Greene wrote: >> Looking for a way to use the Python 3 print() function with encoding and >> errors parameters. >> Are there any concerns with closing and re-opening sys.stdout so >> sys.stdout has a specific encoding and errors behavior?

Re: print() function with encoding= and errors= parameters?

2016-08-03 Thread Random832
On Wed, Aug 3, 2016, at 11:09, Peter Otten wrote: > I'm unsure about this myself -- wouldn't it be better to detach the > underlying raw stream? Like Well, "better" depends on your point of view. > The ValueError raised if you try to write to the original stdout > looks like a feature to me. Ma

Re: print() function with encoding= and errors= parameters?

2016-08-03 Thread Malcolm Greene
Thank you Random832 and Peter - excellent ideas. My use case was diagnostic output being (temporarily) output to stdout via debug related print statements. The output is for debugging only and not meant for production. I was looking for a solution that would allow me to output to the console with

Re: print() function with encoding= and errors= parameters?

2016-08-03 Thread Chris Angelico
On Thu, Aug 4, 2016 at 1:35 AM, Malcolm Greene wrote: > My use case was diagnostic output being (temporarily) output to stdout > via debug related print statements. The output is for debugging only and > not meant for production. I was looking for a solution that would allow > me to output to the

Re: print() function with encoding= and errors= parameters?

2016-08-03 Thread Malcolm Greene
Chris, > Don't forget that the print function can simply be shadowed. I did forget! Another excellent option. Thank you! Malcolm -- https://mail.python.org/mailman/listinfo/python-list

Re: Why not allow empty code blocks?

2016-08-03 Thread BartC
On 03/08/2016 14:31, Chris Angelico wrote: On Wed, Aug 3, 2016 at 11:23 PM, BartC wrote: On 03/08/2016 09:58, Steven D'Aprano wrote: Python is sometimes described as a Lisp with more sensible syntax, so its not surprising that it is relatively simple to translate Python to Lisp and visa versa

Re: print() function with encoding= and errors= parameters?

2016-08-03 Thread eryk sun
On Wed, Aug 3, 2016 at 3:35 PM, Malcolm Greene wrote: > But under Windows, the stdout is workstation specific and *never* UTF-8. So > the > occasional non-ASCII string trips up our diagnostic output when tested under > Windows. You could use win_unicode_console enabled in sitecustomize or usercu

Re: print() function with encoding= and errors= parameters?

2016-08-03 Thread Malcolm Greene
> You could use win_unicode_console enabled in sitecustomize or usercustomize. > https://pypi.python.org/pypi/win_unicode_console The pypi link you shared has an excellent summary of the issues associated when working Unicode from the Windows terminal. Thank you Eryk. Malcolm -- https://mail.py

Re: Why not allow empty code blocks?

2016-08-03 Thread Chris Angelico
On Thu, Aug 4, 2016 at 4:52 AM, BartC wrote: > On 03/08/2016 14:31, Chris Angelico wrote: >> >> On Wed, Aug 3, 2016 at 11:23 PM, BartC wrote: >>> >>> On 03/08/2016 09:58, Steven D'Aprano wrote: >>> >>> But sometimes you try to find a .py import module and it doesn't seem to >>> exist anywhere. (s

Re: Why not allow empty code blocks?

2016-08-03 Thread alister
On Wed, 03 Aug 2016 14:06:06 +, Grant Edwards wrote: > On 2016-08-03, Rustom Mody wrote: > >> The first nokia I used never crashed but could still run out of battery >> And the round-dial landlines of 30 years ago had not even that problem > > Yes, technically, it did. Except the batteries

Re: Why not allow empty code blocks?

2016-08-03 Thread BartC
On 03/08/2016 21:12, Chris Angelico wrote: On Thu, Aug 4, 2016 at 4:52 AM, BartC wrote: On 03/08/2016 14:31, Chris Angelico wrote: On Wed, Aug 3, 2016 at 11:23 PM, BartC wrote: On 03/08/2016 09:58, Steven D'Aprano wrote: But sometimes you try to find a .py import module and it doesn't see

Re: Why not allow empty code blocks?

2016-08-03 Thread Chris Angelico
On Thu, Aug 4, 2016 at 6:53 AM, BartC wrote: > On 03/08/2016 21:12, Chris Angelico wrote: >> >> Fairly common approach - and it means you'll never find those .py >> files. So it's no different from looking for sys.py and not finding >> it, except that in the case of CPython's sys, it's not even a

Re: Issue with ctypes and callback functions

2016-08-03 Thread eryk sun
On Wed, Aug 3, 2016 at 1:21 PM, Bill Somerville wrote: > I can extend the SWIG shadow class to do the creation of the prototype and > thunk, the > required cast above and any extra attributes or methods like _as_parameter_ > and > from_param() but I can't see any way of having the Python callbac

Re: Why not allow empty code blocks?

2016-08-03 Thread BartC
On 03/08/2016 22:39, Chris Angelico wrote: On Thu, Aug 4, 2016 at 6:53 AM, BartC wrote: On 03/08/2016 21:12, Chris Angelico wrote: Fairly common approach - and it means you'll never find those .py files. So it's no different from looking for sys.py and not finding it, except that in the case

Re: Why not allow empty code blocks?

2016-08-03 Thread Chris Angelico
On Thu, Aug 4, 2016 at 8:21 AM, BartC wrote: > But is this a generic mechanism that works for /any/ .dll file, or does > there have to be dedicated support for each of the 60 built-in modules? > > I'm talking about the former. Frankly, I don't want that. Most C APIs are horrendously unPythonic, s

Re: Why not allow empty code blocks?

2016-08-03 Thread Paul Rubin
BartC writes: > sometimes you try to find a .py import module and it > doesn't seem to exist anywhere. (sys.py for example). > I would like to see how such references are translated to Lisp. (require 'sys) -- https://mail.python.org/mailman/listinfo/python-list

Re: Why not allow empty code blocks?

2016-08-03 Thread BartC
On 04/08/2016 00:25, Paul Rubin wrote: BartC writes: sometimes you try to find a .py import module and it doesn't seem to exist anywhere. (sys.py for example). I would like to see how such references are translated to Lisp. (require 'sys) What does that do? Don't tell me that every Lisp c

Re: Why not allow empty code blocks?

2016-08-03 Thread BartC
On 03/08/2016 23:31, Chris Angelico wrote: On Thu, Aug 4, 2016 at 8:21 AM, BartC wrote: But is this a generic mechanism that works for /any/ .dll file, or does there have to be dedicated support for each of the 60 built-in modules? I'm talking about the former. Frankly, I don't want that. Mo

Getting started with type-checking

2016-08-03 Thread Steven D'Aprano
Is there a good guide to getting started with type-checking Python code? Specifically as an aid to porting from Python 2 to 3. There are the PEPs, of course. Anything else? Apart from mypy, what type checkers are available? -- Steve “Cheer up,” they said, “things could be worse.” So I cheered

Re: ctypes Usage Note

2016-08-03 Thread Lawrence D’Oliveiro
On Tuesday, August 2, 2016 at 6:46:45 PM UTC+12, I wrote: > On Tuesday, August 2, 2016 at 5:18:14 PM UTC+12, eryk sun wrote: > >> I recommend using ctypes.CDLL instead. ctypes.cdll is pretty much >> pointless on Unix systems (and a potential problem on Windows due to >> cached function pointers).

Re: can't add variables to instances of built-in classes

2016-08-03 Thread Lawrence D’Oliveiro
On Thursday, July 21, 2016 at 2:29:53 PM UTC+12, Chris Angelico wrote: > Using __slots__ basically takes your object down to the level of a > Java one. Is Java like a bogeyman you use to scare people with if they don’t write Python code the way you like it? -- https://mail.python.org/mailman/li

Re: can't add variables to instances of built-in classes

2016-08-03 Thread Chris Angelico
On Thu, Aug 4, 2016 at 12:34 PM, Lawrence D’Oliveiro wrote: > On Thursday, July 21, 2016 at 2:29:53 PM UTC+12, Chris Angelico wrote: > >> Using __slots__ basically takes your object down to the level of a >> Java one. > > Is Java like a bogeyman you use to scare people with if they don’t write >

Re: Debugging (was Re: Why not allow empty code blocks?)

2016-08-03 Thread Steven D'Aprano
On Wed, 3 Aug 2016 08:16 pm, BartC wrote: > On 03/08/2016 06:43, Steven D'Aprano wrote: > >> Not everything that is done is worth the cognitive burden of memorising a >> special case. > > >> In some ways, Python is a more minimalist language than you like. That's >> okay, you're allowed to