Re: Invalid error in python program

2018-07-08 Thread Chris Angelico
On Mon, Jul 9, 2018 at 10:02 AM, Steven D'Aprano wrote: > On Sun, 08 Jul 2018 22:13:59 +0530, Prafull Ks wrote: > >> I miss studying in class 11 cbse.College as introduced us python. I >> installed it in my laptop but when I save and runed in idle mod. The >> 3.7.0 the 7 is highlighted and syntax

Re: Invalid error in python program

2018-07-08 Thread Steven D'Aprano
On Sun, 08 Jul 2018 22:13:59 +0530, Prafull Ks wrote: > I miss studying in class 11 cbse.College as introduced us python. I > installed it in my laptop but when I save and runed in idle mod. The > 3.7.0 the 7 is highlighted and syntax error is showen. As showen in the > screen shot below. Unless

Re: Invalid error in python program

2018-07-08 Thread Steven D'Aprano
On Sun, 08 Jul 2018 13:02:35 -0400, Etienne Robillard wrote: > I'm guessing you may need some help in english writing too! Now that's not fair. Not everyone is fluent in English and so long as they make a genuine attempt we should be kind enough to ignore minor spelling and grammatical errors.

Re: Generate a static back-of-a-book style index?

2018-07-08 Thread Cameron Simpson
On 08Jul2018 06:47, Tim Chase wrote: On 2018-07-08 13:34, Cameron Simpson wrote: On 07Jul2018 21:57, Tim Chase wrote: >On 2018-07-08 12:12, Cameron Simpson wrote: >> On 07Jul2018 20:11, Skip Montanaro >> wrote: >> >> Have you looked at the ptx command? Might be called "gptx" It's associated

Re: Thread-safe way to add a key to a dict only if it isn't already there?

2018-07-08 Thread Marko Rauhamaa
Chris Angelico : > On Mon, Jul 9, 2018 at 5:18 AM, Marko Rauhamaa wrote: >> Chris Angelico : >>> Are you assuming that Python's semantics are defined by the semantics >>> of one possible implementation language? >> >> What are Python's semantics defined by? I've been using these: >> >>https:/

Re: Thread-safe way to add a key to a dict only if it isn't already there?

2018-07-08 Thread Chris Angelico
On Mon, Jul 9, 2018 at 5:18 AM, Marko Rauhamaa wrote: > Chris Angelico : >> Are you assuming that Python's semantics are defined by the semantics >> of one possible implementation language? > > What are Python's semantics defined by? I've been using these: > >https://docs.python.org/3/referenc

Re: Thread-safe way to add a key to a dict only if it isn't already there?

2018-07-08 Thread Marko Rauhamaa
Chris Angelico : > Are you assuming that Python's semantics are defined by the semantics > of one possible implementation language? What are Python's semantics defined by? I've been using these: https://docs.python.org/3/reference/> https://docs.python.org/3/library/> Unfortunately, neith

Re: Thread-safe way to add a key to a dict only if it isn't already there?

2018-07-08 Thread Chris Angelico
On Mon, Jul 9, 2018 at 4:57 AM, Marko Rauhamaa wrote: > Chris Angelico : > >> On Mon, Jul 9, 2018 at 2:11 AM, Marko Rauhamaa wrote: >>> MRAB : In C you'd declare 'quit' as 'volatile' to tell the compiler that it could change unexpectedly, so don't make that assumption. >>> >>> C is an e

Re: Thread-safe way to add a key to a dict only if it isn't already there?

2018-07-08 Thread Marko Rauhamaa
Chris Angelico : > On Mon, Jul 9, 2018 at 2:11 AM, Marko Rauhamaa wrote: >> MRAB : >>> In C you'd declare 'quit' as 'volatile' to tell the compiler that it >>> could change unexpectedly, so don't make that assumption. >> >> C is an even tougher case. Even if the compiler kept on checking a >> vol

Re: Thread-safe way to add a key to a dict only if it isn't already there?

2018-07-08 Thread Steven D'Aprano
On Sun, 08 Jul 2018 16:37:11 +0100, MRAB wrote: > On 2018-07-08 14:38, Steven D'Aprano wrote: >> On Sun, 08 Jul 2018 14:11:58 +0300, Marko Rauhamaa wrote: >> > [snip] >>> More importantly, this loop may never finish: >>> >>> # Initially >>> quit = False >>> >>> # Thread 1 >>> gl

Re: Thread-safe way to add a key to a dict only if it isn't already there?

2018-07-08 Thread Steven D'Aprano
On Sun, 08 Jul 2018 19:35:55 +0300, Marko Rauhamaa wrote: > Steven D'Aprano : >> On Sun, 08 Jul 2018 14:11:58 +0300, Marko Rauhamaa wrote: >>> PS My example with "impossible" being the result of a racy integer >>> operation is of course unlikely but could be the outcome if the Python >>> runtime r

Re: Invalid error in python program

2018-07-08 Thread Etienne Robillard
I'm guessing you may need some help in english writing too! Anyways, I don't think anyone here may want to make your homeworks for you... Regards, Etienne Le 2018-07-08 à 12:43, Prafull Ks a écrit : I miss studying in class 11 cbse.College as introduced us python. I installed it in my lapto

Re: Invalid error in python program

2018-07-08 Thread Abdur-Rahmaan Janhangeer
screenshots are not sent in this list, can you please copy paste th error or use paste bin? thanks ! Abdur-Rahmaan Janhangeer https://github.com/Abdur-rahmaanJ -- https://mail.python.org/mailman/listinfo/python-list

Invalid error in python program

2018-07-08 Thread Prafull Ks
I miss studying in class 11 cbse.College as introduced us python. I installed it in my laptop but when I save and runed in idle mod. The 3.7.0 the 7 is highlighted and syntax error is showen. As showen in the screen shot below. Plz help me resolve this problem Ur faithful user Prafull. Thank you --

Re: Thread-safe way to add a key to a dict only if it isn't already there?

2018-07-08 Thread Chris Angelico
On Mon, Jul 9, 2018 at 2:11 AM, Marko Rauhamaa wrote: > MRAB : >> On 2018-07-08 14:38, Steven D'Aprano wrote: >>> On Sun, 08 Jul 2018 14:11:58 +0300, Marko Rauhamaa wrote: >>> >> [snip] More importantly, this loop may never finish: # Initially quit = False

Re: Thread-safe way to add a key to a dict only if it isn't already there?

2018-07-08 Thread Marko Rauhamaa
Steven D'Aprano : > On Sun, 08 Jul 2018 14:11:58 +0300, Marko Rauhamaa wrote: >> PS My example with "impossible" being the result of a racy integer >> operation is of course unlikely but could be the outcome if the Python >> runtime reorganized its object cache on the fly (in a hypothetical >> impl

Re: Thread-safe way to add a key to a dict only if it isn't already there?

2018-07-08 Thread Marko Rauhamaa
MRAB : > On 2018-07-08 14:38, Steven D'Aprano wrote: >> On Sun, 08 Jul 2018 14:11:58 +0300, Marko Rauhamaa wrote: >> > [snip] >>> More importantly, this loop may never finish: >>> >>> # Initially >>> quit = False >>> >>> # Thread 1 >>> global quit >>> while not quit: >>>

Re: Thread-safe way to add a key to a dict only if it isn't already there?

2018-07-08 Thread MRAB
On 2018-07-08 14:38, Steven D'Aprano wrote: On Sun, 08 Jul 2018 14:11:58 +0300, Marko Rauhamaa wrote: [snip] More importantly, this loop may never finish: # Initially quit = False # Thread 1 global quit while not quit: time.sleep(1) # Thread 2 global quit

Re: Thread-safe way to add a key to a dict only if it isn't already there?

2018-07-08 Thread Steven D'Aprano
On Sun, 08 Jul 2018 14:11:58 +0300, Marko Rauhamaa wrote: > Steven D'Aprano : >> Changing implementations from one which is thread safe to one which is >> not can break people's code, and shouldn't be done on a whim. >> Especially since such breakage could be subtle, hard to notice, harder >> to t

Re: testing code

2018-07-08 Thread Sharan Basappa
On Sunday, 8 July 2018 12:42:07 UTC+5:30, Christian Gollwitzer wrote: > Am 08.07.18 um 06:21 schrieb Sharan Basappa: > > sorry. there was a copy paste error when i posted. I pasted test_2.py for > > both the files: > > > > here are the files again. The issue remains. > > > output: > > %run "D:/

Re: Generate a static back-of-a-book style index?

2018-07-08 Thread Tim Chase
On 2018-07-08 13:34, Cameron Simpson wrote: > On 07Jul2018 21:57, Tim Chase wrote: > >On 2018-07-08 12:12, Cameron Simpson wrote: > >> On 07Jul2018 20:11, Skip Montanaro > >> wrote: > >> >> Have you looked at the ptx command? Might be called "gptx" > > It's associated with the troff stuff

Re: Thread-safe way to add a key to a dict only if it isn't already there?

2018-07-08 Thread Marko Rauhamaa
Steven D'Aprano : > Changing implementations from one which is thread safe to one which is > not can break people's code, and shouldn't be done on a whim. > Especially since such breakage could be subtle, hard to notice, harder > to track down, and even harder still to fix. Java's HotSpot does it

Re: Thread-safe way to add a key to a dict only if it isn't already there?

2018-07-08 Thread Steven D'Aprano
On Sun, 08 Jul 2018 10:52:15 +0300, Marko Rauhamaa wrote: > You are on the right track, Chris, but you are still deducing behavior > from a particular implementation. For example Java's definition is > approximately the one I give above: > >Without correct synchronization, very strange, confu

Re: about main()

2018-07-08 Thread Abdur-Rahmaan Janhangeer
non native speakers try to do their best as for ... who can't be bothered to use correct grammar in English, and probably are comparably sloppy in their code. ... maybe but check INADA NAOKI Abdur-Rahmaan Janhangeer https://github.com/Abdur-rahmaanJ or the practicality of killfiling people who

Re: about main()

2018-07-08 Thread Abdur-Rahmaan Janhangeer
i appreciate every suggestions though ^^_ Abdur-Rahmaan Janhangeer https://github.com/Abdur-rahmaanJ Ahh, yes. The elegant purity of reading every email that goes through > this mailing list, or the practicality of killfiling people who can't > be bothered to use correct grammar in English, and p

Re: Thread-safe way to add a key to a dict only if it isn't already there?

2018-07-08 Thread Marko Rauhamaa
Chris Angelico : > On Sun, Jul 8, 2018 at 11:04 AM, Steven D'Aprano > wrote: >>> The only thing Python should guarantee is that the data structures stay >>> "coherent" under race conditions. In other words, there cannot be a >>> segmentation fault. For example, if two threads executed this code i

Re: testing code

2018-07-08 Thread Christian Gollwitzer
Am 08.07.18 um 06:21 schrieb Sharan Basappa: sorry. there was a copy paste error when i posted. I pasted test_2.py for both the files: here are the files again. The issue remains. output: %run "D:/Projects/Initiatives/machine learning/programs/test_2_test.py" 30 Jim spotted it... '%run' i

Re: testing code

2018-07-08 Thread Sharan Basappa
On Sunday, 8 July 2018 11:52:39 UTC+5:30, Jim Lee wrote: > On 07/07/18 21:21, Sharan Basappa wrote: > > > > sorry. there was a copy paste error when i posted. I pasted test_2.py for > > both the files: > > > > here are the files again. The issue remains. > > [...] > > > > output: > > %run "D:/Pro