Re: Undefined behaviour in C [was Re: The Cost of Dynamism]

2016-03-26 Thread Marko Rauhamaa
Steven D'Aprano : > On Sat, 26 Mar 2016 03:57 am, Marko Rauhamaa wrote: >> Yes, although the same could be true for Python as well. > > Is this a philosophical question? Yes, it *could* be true, in some > alternate universe, but it isn't actually true. > > Python does not have undefined behaviour

How to make Python interpreter a little more strict?

2016-03-26 Thread Aleksander Alekseev
Hello Recently I spend half an hour looking for a bug in code like this: eax@fujitsu:~/temp$ cat ./t.py #!/usr/bin/env python3 for x in range(0,5): if x % 2 == 0: next print(str(x)) eax@fujitsu:~/temp$ ./t.py 0 1 2 3 4 Is it possible to make python complain in this case? Or m

Interpretation

2016-03-26 Thread Dennis Ngeno
My programs have never combile, they keep telling me , systax error even after copy pasting -- https://mail.python.org/mailman/listinfo/python-list

Re: Suggestion: make sequence and map interfaces more similar

2016-03-26 Thread Marco Sulla
> That's a very superficial similarity: a list ['a', 'b', 'x', 'y'] is > something like a mapping {0: 'a', 1: 'b', 2: 'x', 3: 'y'}. Seems logical, > since in both cases we write collection[2] and get 'x' back. > > But think about it a bit more, and you will see that the behaviour is in > fact *very

I need help

2016-03-26 Thread matthew thiel
So I downloaded python and made an account but when I run it all it does is give me 3 options repair modify and uninstall I have clicked repair and modify and let them run but at the end it just exit out so how do I get it to work??? Sent from Mail

Re: Suggestion: make sequence and map interfaces more similar

2016-03-26 Thread Marco Sulla
Peter Otten wrote: >> I noticed that the sequence types does not have these methods that the map >> types has: get(), items(), keys(), values(). >> It could seem useless to have them for sequences, but I think it will ease >> the creation of functions and methods that allow you to input a generic

PLEASE HELP -- TOTALLY NEW TO PYTHON

2016-03-26 Thread Juan Dent
I am trying to run ‘python cppdep.py’ but get the following: analyzing dependencies among all components ... Traceback (most recent call last): File "cppdep.py", line 675, in main() File "cppdep.py", line 64

Re: How to make Python interpreter a little more strict?

2016-03-26 Thread Nick Sarbicki
On Sat, Mar 26, 2016 at 9:59 AM Aleksander Alekseev wrote: > Hello > > Recently I spend half an hour looking for a bug in code like this: > > eax@fujitsu:~/temp$ cat ./t.py > #!/usr/bin/env python3 > > for x in range(0,5): > if x % 2 == 0: > next > print(str(x)) > > eax@fujitsu:~/

Re: Interpretation

2016-03-26 Thread Mark Lawrence
On 25/03/2016 16:33, Dennis Ngeno wrote: My programs have never combile, they keep telling me , systax error even after copy pasting Please show us your code and the exact syntax error. What Python version and OS are you using? -- My fellow Pythonistas, ask not what our language can do for

Re: Suggestion: make sequence and map interfaces more similar

2016-03-26 Thread Mark Lawrence
On 26/03/2016 00:35, Marco Sulla wrote: I'd like to see vdict implemented anyway. It can't break old code and add a map type that has a common interface with sequences. I cannot see this happening unless you provide a patch on the bug tracker. However I suspect you can get the same thing by

Re: Undefined behaviour in C [was Re: The Cost of Dynamism]

2016-03-26 Thread Steven D'Aprano
On Sat, 26 Mar 2016 04:30 pm, Rustom Mody wrote: > For one thing its good to remember that we wouldn't be here without python > Python wouldn't be what it is without CPython There is nothing about Python that relies on the C standard being as it is. There are Python implementations that are not w

Re: PLEASE HELP -- TOTALLY NEW TO PYTHON

2016-03-26 Thread Mark Lawrence
On 26/03/2016 05:31, Juan Dent wrote: I am trying to run ‘python cppdep.py’ but get the following: analyzing dependencies among all components ... Traceback (most recent call last): File "cppdep.py", line 675, i

Re: How to make Python interpreter a little more strict?

2016-03-26 Thread Chris Warrick
On 25 March 2016 at 13:06, Aleksander Alekseev wrote: > Hello > > Recently I spend half an hour looking for a bug in code like this: > > eax@fujitsu:~/temp$ cat ./t.py > #!/usr/bin/env python3 > > for x in range(0,5): > if x % 2 == 0: > next > print(str(x)) > > eax@fujitsu:~/temp$

Urgent Question Please

2016-03-26 Thread sanaaabdullah21
Hi Python developers, I am trying to click on the testInstance button using pywinauto but I couldn't do it, even it returns empty list when I try to print the controllers . Here is what I tried: app = application.Application() app=app.Connect(path = r"C:\\hdmt\\tos_2.5.2.0_release\\tosrelease\\b

Re: How to make Python interpreter a little more strict?

2016-03-26 Thread Mark Lawrence
On 25/03/2016 12:06, Aleksander Alekseev wrote: Hello Recently I spend half an hour looking for a bug in code like this: eax@fujitsu:~/temp$ cat ./t.py #!/usr/bin/env python3 for x in range(0,5): if x % 2 == 0: next print(str(x)) eax@fujitsu:~/temp$ ./t.py 0 1 2 3 4 Is it

Re: [OT'ish] Is there a list as good as this for Javascript

2016-03-26 Thread Ned Batchelder
On Friday, March 25, 2016 at 11:37:34 PM UTC-4, Thomas 'PointedEars' Lahn wrote: > Chris Angelico wrote: > > > On Sat, Mar 26, 2016 at 12:36 PM, Thomas 'PointedEars' Lahn > > wrote: > >>> Thomas is not typical of the Python community. We are mostly nice > >>> people. > >>> :) > >> > >> You do not

Re: Suggestion: make sequence and map interfaces more similar

2016-03-26 Thread Steven D'Aprano
On Sat, 26 Mar 2016 11:18 am, Marco Sulla wrote: >> That's a very superficial similarity: a list ['a', 'b', 'x', 'y'] is >> something like a mapping {0: 'a', 1: 'b', 2: 'x', 3: 'y'}. Seems logical, >> since in both cases we write collection[2] and get 'x' back. Marco, it is considered polite to g

Re: I need help

2016-03-26 Thread Steven D'Aprano
On Sat, 26 Mar 2016 05:52 am, matthew thiel wrote: > So I downloaded python and made an account but when I run it all it does > is give me 3 options repair modify and uninstall I have clicked repair and > modify and let them run but at the end it just exit out so how do I get it > to work??? You

Re: [OT'ish] Is there a list as good as this for Javascript

2016-03-26 Thread Larry Martell
On Sat, Mar 26, 2016 at 7:37 AM, Ned Batchelder wrote: > Thomas, you don't have to choose between correct and nice. It's > possible to be both. "I'm not good, I'm not nice, I'm just right." That was written by Stephen Sondheim and it's from his musical Into The Woods. It's said by the witch. Th

Re: PLEASE HELP -- TOTALLY NEW TO PYTHON

2016-03-26 Thread Ned Batchelder
On Saturday, March 26, 2016 at 5:59:30 AM UTC-4, Juan Dent wrote: > I am trying to run 'python cppdep.py' but get the following: > > > analyzing dependencies among all components ... > Traceback (most recent call last

Re: PLEASE HELP -- TOTALLY NEW TO PYTHON

2016-03-26 Thread Steven D'Aprano
On Sat, 26 Mar 2016 04:31 pm, Juan Dent wrote: > > I am trying to run ‘python cppdep.py’ but get the following: > > > analyzing dependencies among all components ... > Traceback (most recent call last): > File "cp

Re: Undefined behaviour in C [was Re: The Cost of Dynamism]

2016-03-26 Thread Chris Angelico
On Sat, Mar 26, 2016 at 9:39 PM, Steven D'Aprano wrote: > It is an accident of history that Python's first and major implementation > happens to be written in C. (Although its use as a glue language, allowing > people to safely use libraries written in C, probably played a role in > ensuring Pytho

Re: How to make Python interpreter a little more strict?

2016-03-26 Thread Steven D'Aprano
On Fri, 25 Mar 2016 11:06 pm, Aleksander Alekseev wrote: > Is it possible to make python complain in this case? Or maybe solve > such an issue somehow else? This is a job for a "linter", such as pychecker, pylint or pyflakes. Google for more if you are interested. A linter will check your code f

Re: How to make Python interpreter a little more strict?

2016-03-26 Thread Chris Angelico
On Fri, Mar 25, 2016 at 11:06 PM, Aleksander Alekseev wrote: > Recently I spend half an hour looking for a bug in code like this: > > eax@fujitsu:~/temp$ cat ./t.py > #!/usr/bin/env python3 > > for x in range(0,5): > if x % 2 == 0: > next > print(str(x)) > > eax@fujitsu:~/temp$ ./t

Re: Undefined behaviour in C [was Re: The Cost of Dynamism]

2016-03-26 Thread Steven D'Aprano
On Sat, 26 Mar 2016 01:59 pm, Paul Rubin wrote: > Steven D'Aprano writes: >> Culturally, C compiler writers have a preference for using undefined >> behaviour to allow optimizations, even if it means changing the semantics >> of your code. > > If your code has UB then by definition it has no sem

Re: Undefined behaviour in C [was Re: The Cost of Dynamism]

2016-03-26 Thread Chris Angelico
On Sat, Mar 26, 2016 at 11:21 PM, Steven D'Aprano wrote: > In plain English, if the programmer had an intention for the code, and it > was valid C syntax, it's not hard to conclude that the code has some > meaning. Even if that meaning isn't quite what the programmer expected. > Compilers are well

Re: [OT'ish] Is there a list as good as this for Javascript

2016-03-26 Thread cl
Ned Batchelder wrote: > On Friday, March 25, 2016 at 5:17:21 PM UTC-4, Thomas 'PointedEars' Lahn > wrote: > > c...@isbd.net wrote: > > > > > Occasionally I have to make forays into Javascript, can anyone > > > recommend a place similar to this list where Javascript questions can > > > be asked?

Re: [OT'ish] Is there a list as good as this for Javascript

2016-03-26 Thread cl
Thomas 'PointedEars' Lahn wrote: > c...@isbd.net wrote: > > > Occasionally I have to make forays into Javascript, can anyone > > recommend a place similar to this list where Javascript questions can > > be asked? The trouble is that there are very many usenet Javascript > > lists and it's diffic

Re: Undefined behaviour in C [was Re: The Cost of Dynamism]

2016-03-26 Thread BartC
On 26/03/2016 13:22, Chris Angelico wrote: On Sat, Mar 26, 2016 at 11:21 PM, Steven D'Aprano wrote: In plain English, if the programmer had an intention for the code, and it was valid C syntax, it's not hard to conclude that the code has some meaning. Even if that meaning isn't quite what the p

Re: Undefined behaviour in C [was Re: The Cost of Dynamism]

2016-03-26 Thread Chris Angelico
On Sun, Mar 27, 2016 at 1:09 AM, BartC wrote: > I'm surprised that both C and Python allow statements that apparently do > nothing. In both, an example is: > > x > > on a line by itself. This expression is evaluated, but then any result > discarded. If there was a genuine use for this (for examp

Re: [OT'ish] Is there a list as good as this for Javascript

2016-03-26 Thread Mark Lawrence
On 24/03/2016 20:53, c...@isbd.net wrote: I use Python wherever I can and find this list (as a usenet group via gmane) an invaluable help at times. Occasionally I have to make forays into Javascript, can anyone recommend a place similar to this list where Javascript questions can be asked? The

Re: Undefined behaviour in C [was Re: The Cost of Dynamism]

2016-03-26 Thread BartC
On 26/03/2016 14:30, Chris Angelico wrote: On Sun, Mar 27, 2016 at 1:09 AM, BartC wrote: I'm surprised that both C and Python allow statements that apparently do nothing. In both, an example is: x on a line by itself. This expression is evaluated, but then any result discarded. If there wa

Re: [OT'ish] Is there a list as good as this for Javascript

2016-03-26 Thread Gene Heskett
On Saturday 26 March 2016 07:52:05 Larry Martell wrote: > On Sat, Mar 26, 2016 at 7:37 AM, Ned Batchelder wrote: > > Thomas, you don't have to choose between correct and nice. It's > > possible to be both. > > "I'm not good, I'm not nice, I'm just right." > > That was written by Stephen Sondhei

Re: [OT'ish] Is there a list as good as this for Javascript

2016-03-26 Thread Larry Martell
On Sat, Mar 26, 2016 at 11:31 AM, Gene Heskett wrote: > On Saturday 26 March 2016 07:52:05 Larry Martell wrote: >> As my wife once said, "If you start with 'Listen, asshole, ...' they >> probably won't hear what you have to say after that. > > She is 100% correct, but try as I might, I can't quite

Re: [OT'ish] Is there a list as good as this for Javascript

2016-03-26 Thread Gene Heskett
On Saturday 26 March 2016 11:35:52 Larry Martell wrote: > On Sat, Mar 26, 2016 at 11:31 AM, Gene Heskett wrote: > > On Saturday 26 March 2016 07:52:05 Larry Martell wrote: > >> As my wife once said, "If you start with 'Listen, asshole, ...' > >> they probably won't hear what you have to say afte

Exclude every nth element from list?

2016-03-26 Thread beliavsky--- via Python-list
I can use x[::n] to select every nth element of a list. Is there a one-liner to get a list that excludes every nth element? -- https://mail.python.org/mailman/listinfo/python-list

Re: PLEASE HELP -- TOTALLY NEW TO PYTHON

2016-03-26 Thread Gary Herron
On 03/25/2016 10:31 PM, Juan Dent wrote: I am trying to run ‘python cppdep.py’ but get the following: I would guess that this code was written some time ago for Python2, but that you have downloaded and run it with Python3. Try installing Python2 instead of Python3. Or try talking whoever

Re: Exclude every nth element from list?

2016-03-26 Thread Gary Herron
On 03/26/2016 09:49 AM, beliavsky--- via Python-list wrote: I can use x[::n] to select every nth element of a list. Is there a one-liner to get a list that excludes every nth element? Yes: >>> L=list(range(20)) >>> [x for i,x in enumerate(L) if i%3 != 0] [1, 2, 4, 5, 7, 8, 10, 11, 13, 14,

Re: Exclude every nth element from list?

2016-03-26 Thread Bob Gailer
On Mar 26, 2016 12:50 PM, "beliavsky--- via Python-list" < python-list@python.org> wrote: > > I can use x[::n] to select every nth element of a list. Is there a one-liner to get a list that excludes every nth element? [y for (i,y) in enumerate(x) if i % n] -- https://mail.python.org/mailman/listi

Re: Exclude every nth element from list?

2016-03-26 Thread Erik
On 26/03/16 16:49, beliavsky--- via Python-list wrote: I can use x[::n] to select every nth element of a list. Is there a one-liner to get a list that excludes every nth element? (e for i, e in enumerate(x) if i % n) K. -- https://mail.python.org/mailman/listinfo/python-list

Re: Exclude every nth element from list?

2016-03-26 Thread Vincent Vande Vyvre
Le 26/03/2016 17:49, beliavsky--- via Python-list a écrit : I can use x[::n] to select every nth element of a list. Is there a one-liner to get a list that excludes every nth element? Something like that: >>> l = list("lkodjuyhrtgfedcvfg") >>> l ['l', 'k', 'o', 'd', 'j', 'u', 'y', 'h', 'r', 't

Re: Exclude every nth element from list?

2016-03-26 Thread Peter Otten
beliavsky--- via Python-list wrote: > I can use x[::n] to select every nth element of a list. Is there a > one-liner to get a list that excludes every nth element? del x[::n] ;) -- https://mail.python.org/mailman/listinfo/python-list

Re: Exclude every nth element from list?

2016-03-26 Thread Vincent Vande Vyvre
Le 26/03/2016 18:06, Vincent Vande Vyvre a écrit : Le 26/03/2016 17:49, beliavsky--- via Python-list a écrit : I can use x[::n] to select every nth element of a list. Is there a one-liner to get a list that excludes every nth element? Something like that: >>> l = list("lkodjuyhrtgfedcvfg") >>>

Another Key Binding Question

2016-03-26 Thread Wildman via Python-list
I use some key bindings in my program. They are declared like this: root.bind("" + "q", quit) root.bind("" + "q", quit) root.bind("" + "Q", quit) root.bind("" + "Q", quit) The above binds both Alt keys with upper and lower case 'q'. Is there a way to combine the s

Re: PLEASE HELP -- TOTALLY NEW TO PYTHON

2016-03-26 Thread Joel Goldstick
On Sat, Mar 26, 2016 at 1:31 AM, Juan Dent wrote: > > I am trying to run ‘python cppdep.py’ but get the following: > > > > analyzing dependencies among all components ... > Traceback (most recent call last): > File

Re: Undefined behaviour in C [was Re: The Cost of Dynamism]

2016-03-26 Thread Rustom Mody
On Saturday, March 26, 2016 at 4:09:41 PM UTC+5:30, Steven D'Aprano wrote: > On Sat, 26 Mar 2016 04:30 pm, Rustom Mody wrote: > > > For one thing its good to remember that we wouldn't be here without python > > Python wouldn't be what it is without CPython > > There is nothing about Python that r

Re: Another Key Binding Question

2016-03-26 Thread MRAB
On 2016-03-26 17:10, Wildman via Python-list wrote: I use some key bindings in my program. They are declared like this: root.bind("" + "q", quit) root.bind("" + "q", quit) root.bind("" + "Q", quit) root.bind("" + "Q", quit) The above binds both Alt keys with

Re: [OT'ish] Is there a list as good as this for Javascript

2016-03-26 Thread Michael Torrie
On 03/26/2016 05:37 AM, Ned Batchelder wrote: > [...] > Has anyone ever said to you, "Thanks, Thomas! Lots of people were giving > me answers, but they were all so kind and polite about it, I couldn't > see what they were saying. Finally, your blunt direct manner got > through to me, so now I und

Re: Exclude every nth element from list?

2016-03-26 Thread BartC
On 26/03/2016 16:49, beliav...@aol.com wrote: I can use x[::n] to select every nth element of a list. I would use x[n-1::n] if 'nth' means the 3rd element of [10,20,30,40,...] is 30. Otherwise every selection will include the first, no matter what n is. -- Bartc -- https://mail.python.org

Re: [OT'ish] Is there a list as good as this for Javascript

2016-03-26 Thread Thomas 'PointedEars' Lahn
Mark Lawrence wrote: > On 24/03/2016 20:53, c...@isbd.net wrote: >> I use Python wherever I can and find this list (as a usenet group via >> gmane) an invaluable help at times. >> >> Occasionally I have to make forays into Javascript, can anyone >> recommend a place similar to this list where Java

Re: [OT'ish] Is there a list as good as this for Javascript

2016-03-26 Thread Michael Torrie
On 03/26/2016 11:49 AM, Michael Torrie wrote: > Well said, Ned, and a good reminder for me, and I suspect all of us, to > considering how we communicate. It's our nature to think problems lie ^^ Sigh. Consider. And proof read. > with everyone else but us (as witnessed by recent post

Re: Undefined behaviour in C [was Re: The Cost of Dynamism]

2016-03-26 Thread Terry Reedy
On 3/26/2016 1:43 PM, Rustom Mody wrote: There is this nice piece of OO called the exception hierarchy: > https://docs.python.org/2/library/exceptions.html#exception-hierarchy https://docs.python.org/3/library/exceptions.html#exception-hierarchy BaseException ⊇ Exception ⊇ EnvironmentError

Re: Undefined behaviour in C [was Re: The Cost of Dynamism]

2016-03-26 Thread Chris Angelico
On Sun, Mar 27, 2016 at 4:43 AM, Rustom Mody wrote: > On Saturday, March 26, 2016 at 4:09:41 PM UTC+5:30, Steven D'Aprano wrote: >> On Sat, 26 Mar 2016 04:30 pm, Rustom Mody wrote: >> >> > For one thing its good to remember that we wouldn't be here without python >> > Python wouldn't be what it is

Re: [OT'ish] Is there a list as good as this for Javascript

2016-03-26 Thread Cameron Simpson
On 26Mar2016 02:36, Thomas 'PointedEars' Lahn wrote: Ned Batchelder wrote: Chris, I apologize for Thomas. How dare you to speak for me, Because it is something you never say: sorry for my rudeness. and *again* the rest of the subscribers? He speaks for me at least, on this topic. I was

Re: Exclude every nth element from list?

2016-03-26 Thread beliavsky--- via Python-list
On Saturday, March 26, 2016 at 1:02:06 PM UTC-4, Gary Herron wrote: > On 03/26/2016 09:49 AM, beliavsky--- via Python-list wrote: > > I can use x[::n] to select every nth element of a list. Is there a > > one-liner to get a list that excludes every nth element? > > Yes: > > >>> L=list(range(20)

repeat items in a list

2016-03-26 Thread beliavsky--- via Python-list
I can create a list that has repeated elements of another list as follows: xx = ["a","b"] nrep = 3 print xx yy = [] for aa in xx: for i in range(nrep): yy.append(aa) print yy output: ['a', 'b'] ['a', 'a', 'a', 'b', 'b', 'b'] Is there a one-liner to create a list with repeated element

help with program

2016-03-26 Thread Jerry Martens
hi im trying to run this program and it opens a screen really ast and closes it faster withou any results. im totally a noob. everything i google is confusing. do i need to place this is in a folder or just run from command line? i have the latest version of python. im running win 7. any help wo

Re: help with program

2016-03-26 Thread Chris Angelico
On Sun, Mar 27, 2016 at 7:38 AM, Jerry Martens wrote: > hi im trying to run this program and it opens a screen really ast and closes > it faster withou any results. im totally a noob. everything i google is > confusing. do i need to place this is in a folder or just run from command > line? i h

Re: Exclude every nth element from list?

2016-03-26 Thread Mark Lawrence
On 26/03/2016 22:08, beliavsky--- via Python-list wrote: On Saturday, March 26, 2016 at 1:02:06 PM UTC-4, Gary Herron wrote: On 03/26/2016 09:49 AM, beliavsky--- via Python-list wrote: I can use x[::n] to select every nth element of a list. Is there a one-liner to get a list that excludes ever

setup

2016-03-26 Thread Youssef Ghorab
dear python,i'm having a problem when i'm setting up the program 0x80070570 problem if you please could give me any advice will be cool. thanks in advance -- https://mail.python.org/mailman/listinfo/python-list

Re: help with program

2016-03-26 Thread Mark Lawrence
On 26/03/2016 20:38, Jerry Martens wrote: any help would be appreciated! or could you please point me to a good forum for total noobs?thank you for your time and effort! https://mail.python.org/mailman/listinfo/tutor also available at gmane.comp.python.tutor. -- My fellow Pythonistas, ask

Re: repeat items in a list

2016-03-26 Thread Cameron Simpson
On 26Mar2016 15:12, beliav...@aol.com wrote: I can create a list that has repeated elements of another list as follows: xx = ["a","b"] nrep = 3 print xx yy = [] for aa in xx: for i in range(nrep): yy.append(aa) print yy output: ['a', 'b'] ['a', 'a', 'a', 'b', 'b', 'b'] Is there a on

Re: setup

2016-03-26 Thread Joel Goldstick
On Sat, Mar 26, 2016 at 6:52 PM, Youssef Ghorab wrote: > dear python,i'm having a problem when i'm setting up the program > 0x80070570 problem > if you please could give me any advice will be cool. > thanks in advance > -- > https://mail.python.org/mailman/listinfo/python-list > I'm guessing you

Re: repeat items in a list

2016-03-26 Thread Erik
Hi, On 26/03/16 22:12, beliavsky--- via Python-list wrote: I can create a list that has repeated elements of another list as follows: xx = ["a","b"] nrep = 3 print xx yy = [] for aa in xx: for i in range(nrep): yy.append(aa) print yy output: ['a', 'b'] ['a', 'a', 'a', 'b', 'b', '

Re: repeat items in a list

2016-03-26 Thread Mark Lawrence
On 26/03/2016 22:12, beliavsky--- via Python-list wrote: I can create a list that has repeated elements of another list as follows: xx = ["a","b"] nrep = 3 print xx yy = [] for aa in xx: for i in range(nrep): yy.append(aa) print yy output: ['a', 'b'] ['a', 'a', 'a', 'b', 'b', 'b']

Re: repeat items in a list

2016-03-26 Thread beliavsky--- via Python-list
On Saturday, March 26, 2016 at 7:24:10 PM UTC-4, Erik wrote: > Hi, > > On 26/03/16 22:12, beliavsky--- via Python-list wrote: > > I can create a list that has repeated elements of another list as follows: > > > > xx = ["a","b"] > > nrep = 3 > > print xx > > yy = [] > > for aa in xx: > > for i

Re: repeat items in a list

2016-03-26 Thread beliavsky--- via Python-list
On Saturday, March 26, 2016 at 7:30:14 PM UTC-4, Mark Lawrence wrote: > On 26/03/2016 22:12, beliavsky--- via Python-list wrote: > > I can create a list that has repeated elements of another list as follows: > > > > xx = ["a","b"] > > nrep = 3 > > print xx > > yy = [] > > for aa in xx: > > for

Re: How to make Python interpreter a little more strict?

2016-03-26 Thread John Pote
On 26/03/2016 12:05, Chris Angelico wrote: On Fri, Mar 25, 2016 at 11:06 PM, Aleksander Alekseev wrote: Recently I spend half an hour looking for a bug in code like this: eax@fujitsu:~/temp$ cat ./t.py #!/usr/bin/env python3 for x in range(0,5): if x % 2 == 0: next print(

Re: How to make Python interpreter a little more strict?

2016-03-26 Thread BartC
On 26/03/2016 23:30, John Pote wrote: So intrigued by this question I tried the following def fnc( n ): print "fnc called with parameter '%d'" % n return n for i in range(0,5): if i%2 == 0: fnc next print i and got the same result as the OP A couple of

Re: Undefined behaviour in C [was Re: The Cost of Dynamism]

2016-03-26 Thread Steven D'Aprano
On Sun, 27 Mar 2016 04:43 am, Rustom Mody wrote: > On Saturday, March 26, 2016 at 4:09:41 PM UTC+5:30, Steven D'Aprano wrote: >> On Sat, 26 Mar 2016 04:30 pm, Rustom Mody wrote: >> >> > For one thing its good to remember that we wouldn't be here without >> > python Python wouldn't be what it is w

Re: help with program

2016-03-26 Thread Steven D'Aprano
On Sun, 27 Mar 2016 07:38 am, Jerry Martens wrote: > hi im trying to run this program and it opens a screen really ast and > closes it faster withou any results. Put this at the very end of your program: # Python 2 version raw_input('Press the Enter key to exit... ') # Python 3 version input(

Re: Undefined behaviour in C [was Re: The Cost of Dynamism]

2016-03-26 Thread Chris Angelico
On Sun, Mar 27, 2016 at 1:44 PM, Steven D'Aprano wrote: > If [anyone] takes over the world and bans C, insisting that it be > replaced with a new language of his own design called "T", the > *implementation* of CPython would have to change, but the *interface*, the > language itself, won't have to

Threading is foobared?

2016-03-26 Thread Steven D'Aprano
Am I the only one who has noticed that threading of posts here is severely broken? It's always been the case that there have been a few posts here and there that break threading, but now it seems to be much more common. For instance, I see Jerry Martens' post "help with program". According to my n

Re: Threading is foobared?

2016-03-26 Thread Ben Finney
Steven D'Aprano writes: > Am I the only one who has noticed that threading of posts here is > severely broken? It's always been the case that there have been a few > posts here and there that break threading, but now it seems to be much > more common. I can't give an objective assessment of whet

Re: Interpretation

2016-03-26 Thread Mario R. Osorio
On Saturday, March 26, 2016 at 5:59:04 AM UTC-4, Dennis Ngeno wrote: > My programs have never combile, they keep telling me , systax error even > after copy pasting No pun intended, but I hope you are not typing your code like you typed your message. OTOH, python code is not supposed to be compi

Re: How to make Python interpreter a little more strict?

2016-03-26 Thread Steven D'Aprano
On Sun, 27 Mar 2016 10:30 am, John Pote wrote: > So intrigued by this question I tried the following > def fnc( n ): > print "fnc called with parameter '%d'" % n > return n > > for i in range(0,5): > if i%2 == 0: > fnc > next > print i > > and got the same r

Re: Interpretation

2016-03-26 Thread Ben Finney
"Mario R. Osorio" writes: > On Saturday, March 26, 2016 at 5:59:04 AM UTC-4, Dennis Ngeno wrote: > > My programs have never combile, they keep telling me , systax error even > > after copy pasting > > No pun intended, but I hope you are not typing your code like you > typed your message. Many pe

Re: Interpretation

2016-03-26 Thread Steven D'Aprano
On Sun, 27 Mar 2016 02:22 pm, Mario R. Osorio wrote: > OTOH, python code is not supposed to be compiled. Technically, Python code is compiled, to byte-code rather than machine-code, but still compiled. That's what is inside the .pyc files you will often see after importing modules. And Python ev

Re: Interpretation

2016-03-26 Thread Steven D'Aprano
On Sat, 26 Mar 2016 03:33 am, Dennis Ngeno wrote: > My programs have never combile, they keep telling me , systax error even > after copy pasting Dennis, if Python is complaining that you have a SyntaxError, it means you have written something which the interpreter cannot understand. We cannot po

Re: setup

2016-03-26 Thread eryk sun
On Sat, Mar 26, 2016 at 6:20 PM, Joel Goldstick wrote: > I'm guessing you are on windows and you could google the error code, but > also search the list because this question has been asked and answered I > believe A little knowledge helps. An upper word of 0x8007 indicates a COM HRESULT error (0

Re: [OT'ish] Is there a list as good as this for Javascript

2016-03-26 Thread Gregory Ewing
Gene Heskett wrote: But I learned a lot about hot ($2400F) iron too. 2400 dollars farenheit? That's an intriguing unit... Or is it meant to be the temperature in hex? -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: [OT'ish] Is there a list as good as this for Javascript

2016-03-26 Thread Chris Angelico
On Sun, Mar 27, 2016 at 3:05 PM, Gregory Ewing wrote: > Gene Heskett wrote: >> >> But I learned a lot about hot ($2400F) iron too. > > > 2400 dollars farenheit? That's an intriguing unit... > > Or is it meant to be the temperature in hex? Hex, obviously. Which is something like five thousand Kelv

Re: Undefined behaviour in C [was Re: The Cost of Dynamism]

2016-03-26 Thread Rustom Mody
On Sunday, March 27, 2016 at 2:15:22 AM UTC+5:30, Terry Reedy wrote: > On 3/26/2016 1:43 PM, Rustom Mody wrote: > > > There is this nice piece of OO called the exception hierarchy: > > > https://docs.python.org/2/library/exceptions.html#exception-hierarchy > > https://docs.python.org/3/library/

Re: Another Key Binding Question

2016-03-26 Thread Wildman via Python-list
On Sat, 26 Mar 2016 17:47:02 +, MRAB wrote: > On 2016-03-26 17:10, Wildman via Python-list wrote: >> I use some key bindings in my program. They are declared >> like this: >> >> root.bind("" + "q", quit) >> root.bind("" + "q", quit) >> root.bind("" + "Q", quit) >>

Re: repeat items in a list

2016-03-26 Thread Paul Rubin
beliav...@aol.com writes: > yy = list(chain.from_iterable([list(repeat(aa,nrep)) for aa in xx])) The chain approach seems more natural to me: yy = list(chain.from_iterable(map(lambda x: [x,x], xx))) may make the doubling more obvious, and in Python 3 it should avoid the intermediate lists sinc

Re: Undefined behaviour in C [was Re: The Cost of Dynamism]

2016-03-26 Thread Rustom Mody
On Sunday, March 27, 2016 at 10:32:34 AM UTC+5:30, Rustom Mody wrote: > I had an impression of seeing some discussion on this and resolved not > to incorporate. Meaning: I think I remember something about a resolution -- after some debate -- not to OO-ify the C/Unix errno system -- https://mail.p

Re: Undefined behaviour in C [was Re: The Cost of Dynamism]

2016-03-26 Thread Paul Rubin
Steven D'Aprano writes: > For example, would you consider that this isolated C code is > "meaningless"? > int i = n + 1; It's meaningful as long as n is in a certain range of values so there's no overflow. > But according to the standard, it's "meaningless", since it might > overflow, and signed

Re: Threading is foobared?

2016-03-26 Thread Random832
On Sat, Mar 26, 2016, at 23:18, Ben Finney wrote: > What you've demonstrated is that at least one host is violating > communication standards by altering existing reference fields on > messages in transit. The usenet gateway relays posts that originated on the mailing list to usenet with their *Me

Re: help with program

2016-03-26 Thread Terry Reedy
On 3/26/2016 6:48 PM, Chris Angelico wrote: On Sun, Mar 27, 2016 at 7:38 AM, Jerry Martens wrote: hi im trying to run this program and it opens a screen really ast and closes it faster withou any results. There are a few ways you could do this. One is to run it from the command line. Another

Re: Undefined behaviour in C [was Re: The Cost of Dynamism]

2016-03-26 Thread Paul Rubin
BartC writes: > But my suggestion was to have required a keyword in front of > such expressions. Should there be a keyword in front of a line containing "sqrt(x)" ? What about "launch(missiles)" ? The compiler can't tell which of those expressions has a side effect. The first might be buggy cod

Re: Undefined behaviour in C [was Re: The Cost of Dynamism]

2016-03-26 Thread Paul Rubin
Rustom Mody writes: > eg haskell (ghc) is written in ghc > Where did the first bootstrap start from? The very earliest Haskell implementation was written in Lisp. -- https://mail.python.org/mailman/listinfo/python-list