Re: Question about asyncio and blocking operations

2016-01-25 Thread Paul Rubin
Marko Rauhamaa writes: > Note that neither the multithreading model (which I dislike) nor the > callback hell (which I like) suffer from this problem. There are some runtimes (GHC and Erlang) where everything is nonblocking under the covers, which lets even the asyncs be swept under the rug. Simi

Re: Question about asyncio and blocking operations

2016-01-25 Thread Marko Rauhamaa
Rustom Mody : > Bah -- What a bloody mess! > And thanks for pointing this out, Ian. > Keep wondering whether my brain is atrophying, or its rocket science or... I'm afraid the asyncio idea will not fly. Adding the keywords "async" and "await" did make things much better, but the programming mode

Re: Question about asyncio and blocking operations

2016-01-25 Thread Rustom Mody
On Monday, January 25, 2016 at 9:16:13 PM UTC+5:30, Ian wrote: > On Mon, Jan 25, 2016 at 8:32 AM, Ian Kelly wrote: > > > > On Jan 25, 2016 2:04 AM, "Frank Millman" wrote: > >> > >> "Ian Kelly" wrote in message > >>> > >>> This seems to be a common misapprehension about asyncio programming. > >>>

Tkinter spacing

2016-01-25 Thread KP
If I want to have some space between, say, btn_last & btn_new, will I have to use a dummy label in between these two or is there a better way? Thanks for any help, as always! from tkinter import * from tkinter import ttk root = Tk() root.geometry("822x600+100+100") nav_bar = ttk.Frame(root,

Re: .format won't display my value with 2 decimal places: Why?

2016-01-25 Thread Chris Kaynor
On Mon, Jan 25, 2016 at 9:48 AM, Chris Angelico wrote: > On Tue, Jan 26, 2016 at 4:32 AM, Random832 wrote: > > On Mon, Jan 25, 2016, at 12:23, Chris Angelico wrote: > >> if some translations don't use a token at all, > > > > I'm not sure what situation that would be reasonable in. > > I don't do

Re: .format won't display my value with 2 decimal places: Why?

2016-01-25 Thread Chris Angelico
On Tue, Jan 26, 2016 at 4:32 AM, Random832 wrote: > On Mon, Jan 25, 2016, at 12:23, Chris Angelico wrote: >> if some translations don't use a token at all, > > I'm not sure what situation that would be reasonable in. I don't do much with different human languages, but it's possible that you might

Re: Re[2]: .format won't display my value with 2 decimal places: Why?

2016-01-25 Thread Chris Angelico
On Tue, Jan 26, 2016 at 4:31 AM, Ian Kelly wrote: >> Do you really want to insist that the format string always used _all_ of the >> arguments? > > Good point, that makes sense. For example, I would expect this to work: > > '{0} {2}'.format(*some_list) > > as long as some_list has three elements.

Re: Re[2]: .format won't display my value with 2 decimal places: Why?

2016-01-25 Thread Ian Kelly
On Mon, Jan 25, 2016 at 10:19 AM, MRAB wrote: > > > On 2016-01-25 16:51:36, "Ian Kelly" wrote: > >> >> Why doesn't str.format raise an exception when passed extra positional >> arguments? >> > That format string uses auto-numbering, and it's equivalent to 'The new > price is {0:.2f}'. > > In gene

Re: .format won't display my value with 2 decimal places: Why?

2016-01-25 Thread Random832
On Mon, Jan 25, 2016, at 12:23, Chris Angelico wrote: > if some translations don't use a token at all, I'm not sure what situation that would be reasonable in. -- https://mail.python.org/mailman/listinfo/python-list

Re: .format won't display my value with 2 decimal places: Why?

2016-01-25 Thread Random832
On Mon, Jan 25, 2016, at 12:19, MRAB wrote: > Do you really want to insist that the format string always used _all_ of > the arguments? Um, yes? Why on earth _wouldn't_ you want to insist that? -- https://mail.python.org/mailman/listinfo/python-list

Re: .format won't display my value with 2 decimal places: Why?

2016-01-25 Thread Chris Angelico
On Tue, Jan 26, 2016 at 3:51 AM, Ian Kelly wrote: > On Sun, Jan 24, 2016 at 2:20 PM, MRAB wrote: >> The format method, on the other hand, belongs to the format string it's >> attached to. In this example: >> >> 'The new price is {}' .format(newPrice, '.2f') >> >> the format string is 'The new

Re[2]: .format won't display my value with 2 decimal places: Why?

2016-01-25 Thread MRAB
On 2016-01-25 16:51:36, "Ian Kelly" wrote: On Sun, Jan 24, 2016 at 2:20 PM, MRAB wrote: The format method, on the other hand, belongs to the format string it's attached to. In this example: 'The new price is {}' .format(newPrice, '.2f') the format string is 'The new price is {}'

Re: .format won't display my value with 2 decimal places: Why?

2016-01-25 Thread Ian Kelly
On Sun, Jan 24, 2016 at 2:20 PM, MRAB wrote: > The format method, on the other hand, belongs to the format string it's > attached to. In this example: > > 'The new price is {}' .format(newPrice, '.2f') > > the format string is 'The new price is {}' and you're calling its 'format' > method with

Re: tkinter newbie question

2016-01-25 Thread KP
On Monday, 25 January 2016 00:51:34 UTC-8, Peter Otten wrote: > KP wrote: > > > See my code below (which works). > > >From the import of lowercase "tkinter" I conclude you are using Python 3. > > > I'd like to have the 2nd window as a > > class in a separate unit. How do I code that unit and h

Re: tkinter newbie question

2016-01-25 Thread KP
On Monday, 25 January 2016 08:22:12 UTC-8, KP wrote: > On Monday, 25 January 2016 00:51:34 UTC-8, Peter Otten wrote: > > KP wrote: > > > > > See my code below (which works). > > > > >From the import of lowercase "tkinter" I conclude you are using Python 3. > > > > > I'd like to have the 2nd w

Re: Question about asyncio and blocking operations

2016-01-25 Thread Ian Kelly
On Mon, Jan 25, 2016 at 8:32 AM, Ian Kelly wrote: > > On Jan 25, 2016 2:04 AM, "Frank Millman" wrote: >> >> "Ian Kelly" wrote in message >> news:calwzidngogpx+cpmvba8vpefuq4-bwmvs0gz3shb0owzi0b...@mail.gmail.com... >>> >>> This seems to be a common misapprehension about asyncio programming. >>>

Re: Question about asyncio and blocking operations

2016-01-25 Thread Ian Kelly
On Jan 25, 2016 2:04 AM, "Frank Millman" wrote: > > "Ian Kelly" wrote in message news:calwzidngogpx+cpmvba8vpefuq4-bwmvs0gz3shb0owzi0b...@mail.gmail.com... >> >> This seems to be a common misapprehension about asyncio programming. >> While coroutines are the focus of the library, they're based on

Re: tkinter newbie question

2016-01-25 Thread KP
On Sunday, 24 January 2016 20:20:07 UTC-8, KP wrote: > See my code below (which works). I'd like to have the 2nd window as a class > in a separate unit. How do I code that unit and how do I call it from my > first unit? > > As always, thanks for all help! > > > > > #!/usr/bin/env python > "

Re: Question about asyncio and blocking operations

2016-01-25 Thread Frank Millman
"Ian Kelly" wrote in message news:calwzidngogpx+cpmvba8vpefuq4-bwmvs0gz3shb0owzi0b...@mail.gmail.com... On Sat, Jan 23, 2016 at 7:38 AM, Frank Millman wrote: > Here is the difficulty. The recommended way to handle a blocking > operation > is to run it as task in a different thread, using run_i

Re: Question about asyncio and blocking operations

2016-01-25 Thread Frank Millman
"Ian Kelly" wrote in message news:calwzidngogpx+cpmvba8vpefuq4-bwmvs0gz3shb0owzi0b...@mail.gmail.com... On Sat, Jan 23, 2016 at 7:38 AM, Frank Millman wrote: > Here is the difficulty. The recommended way to handle a blocking > operation > is to run it as task in a different thread, using run_

Re: tkinter newbie question

2016-01-25 Thread Peter Otten
KP wrote: > See my code below (which works). >From the import of lowercase "tkinter" I conclude you are using Python 3. > I'd like to have the 2nd window as a > class in a separate unit. How do I code that unit and how do I call it > from my first unit? > > As always, thanks for all help! Mov