Re: Python is going to be hard

2014-09-04 Thread Chris Angelico
On Fri, Sep 5, 2014 at 12:56 PM, Rustom Mody wrote: > On Friday, September 5, 2014 8:01:00 AM UTC+5:30, Chris Angelico wrote: > >> That's one particular example that's from Unix. I've seen (and >> written) Windows GUI programs that use consoles, too. And OS/2 ones. >> Can't speak for Mac OS Classi

Re: Python is going to be hard

2014-09-04 Thread Rustom Mody
On Friday, September 5, 2014 8:01:00 AM UTC+5:30, Chris Angelico wrote: > That's one particular example that's from Unix. I've seen (and > written) Windows GUI programs that use consoles, too. And OS/2 ones. > Can't speak for Mac OS Classic as I've never used it, but I'd be > surprised if it's not

Re: Python is going to be hard

2014-09-04 Thread Roy Smith
In article , Chris Angelico wrote: > On Fri, Sep 5, 2014 at 12:24 PM, Rustom Mody wrote: > > On Thursday, September 4, 2014 7:38:40 PM UTC+5:30, Chris Angelico wrote: > > > >> So a fairer comparison is: How many applications produce non-debug > >> output on stderr or stdout? And that would be a

Re: Python is going to be hard

2014-09-04 Thread Chris Angelico
On Fri, Sep 5, 2014 at 12:24 PM, Rustom Mody wrote: > On Thursday, September 4, 2014 7:38:40 PM UTC+5:30, Chris Angelico wrote: > >> So a fairer comparison is: How many applications produce non-debug >> output on stderr or stdout? And that would be a much larger >> percentage. Even GUI programs wi

Re: Python is going to be hard

2014-09-04 Thread Rustom Mody
On Thursday, September 4, 2014 7:38:40 PM UTC+5:30, Chris Angelico wrote: > So a fairer comparison is: How many applications produce non-debug > output on stderr or stdout? And that would be a much larger > percentage. Even GUI programs will, in some cases - for instance, try > firing up your favo

Re: Python is going to be hard

2014-09-04 Thread Chris Angelico
On Thu, Sep 4, 2014 at 11:37 PM, Steven D'Aprano wrote: > Chris Angelico wrote: > >> On Thu, Sep 4, 2014 at 4:23 PM, Rustom Mody wrote: >>> You seem to think a print hanging out of a program to be ok, normal. >>> I consider it exceptional. >> >> You keep saying that it's exceptional. You haven't

Re: Python is going to be hard

2014-09-04 Thread Mark Lawrence
On 04/09/2014 14:37, Steven D'Aprano wrote: We often recommend using print as an easy and effective debugging tool. But we don't (well, I don't) recommend leaving those print statements in the code once the problem is debugged. I've given up completely with print for debugging. I start with

Re: Python is going to be hard

2014-09-04 Thread Chris Angelico
On Thu, Sep 4, 2014 at 11:25 PM, Steven D'Aprano wrote: > Of course console output is > often useful, but it is slightly smelly: > > - beginners have a tendency to use print when they should be using > return, and consequently can't easily chain functions together; > > - languages like shell scr

Re: Python is going to be hard

2014-09-04 Thread Steven D'Aprano
Chris Angelico wrote: > On Thu, Sep 4, 2014 at 4:23 PM, Rustom Mody wrote: >> You seem to think a print hanging out of a program to be ok, normal. >> I consider it exceptional. > > You keep saying that it's exceptional. You haven't really said why. > It's the simplest form of "program produces o

Re: Python is going to be hard

2014-09-04 Thread Chris Angelico
On Thu, Sep 4, 2014 at 11:15 PM, Rustom Mody wrote: > How do each of these apply when comparing > a. A program that defaults to passing and returning data structures and >uses print in a very controlled way > > b. A program that randomly mixes call/return with input/print Considering that I'v

Re: Python is going to be hard

2014-09-04 Thread Steven D'Aprano
Chris Angelico wrote: > On Thu, Sep 4, 2014 at 12:10 PM, Rustom Mody > wrote: >> On Thursday, September 4, 2014 7:26:56 AM UTC+5:30, Chris Angelico wrote: >>> On Thu, Sep 4, 2014 at 11:48 AM, Rustom Mody wrote: >>> NO PRINT >> >> >>> Why are you so dead against print? >> >> Because it herald

Re: Python is going to be hard

2014-09-04 Thread Rustom Mody
On Thursday, September 4, 2014 12:10:04 PM UTC+5:30, Chris Angelico wrote: > Practicality beats purity. Nice statement! Now where did I see it?? Let me see... I see next to it some others: - Beautiful is better than ugly. - Explicit is better than implicit. - Simple is better than complex. - Com

Re: Python is going to be hard

2014-09-04 Thread Rustom Mody
On Thursday, September 4, 2014 3:59:57 PM UTC+5:30, alister wrote: > On Wed, 03 Sep 2014 19:33:41 -0700, Rustom Mody wrote: > > On Thursday, September 4, 2014 7:56:31 AM UTC+5:30, Chris Angelico > > wrote: > >> When you start a script, you have a consistent environment - an empty > >> one. When yo

Re: Python is going to be hard

2014-09-04 Thread alister
On Wed, 03 Sep 2014 19:33:41 -0700, Rustom Mody wrote: > On Thursday, September 4, 2014 7:56:31 AM UTC+5:30, Chris Angelico > wrote: >> On Thu, Sep 4, 2014 at 12:10 PM, Rustom Mody wrote: >> > On Thursday, September 4, 2014 7:26:56 AM UTC+5:30, Chris Angelico >> > wrote: >> >> On Thu, Sep 4, 2014

Re: Python is going to be hard

2014-09-03 Thread Chris Angelico
On Thu, Sep 4, 2014 at 4:23 PM, Rustom Mody wrote: > A patient goes to hospital. The first thing the nurses do (even before the > doctor arrives) is to stick all kinds of tubes into... eyes, nose, ears and > other unmentionable places. The doctor arrives and orders a few more > invasions. > Some

Re: Python is going to be hard

2014-09-03 Thread Rustom Mody
On Thursday, September 4, 2014 10:33:38 AM UTC+5:30, Chris Angelico wrote: > On Thu, Sep 4, 2014 at 2:11 PM, Rustom Mody wrote: > > Is there some PEP filed called "Abolish print in python 4" ? > > I dont remember filing any such... > You screamed "NO PRINT" at us in the voice of Edna Mode. (At lea

Re: Python is going to be hard

2014-09-03 Thread Chris Angelico
On Thu, Sep 4, 2014 at 2:11 PM, Rustom Mody wrote: > Is there some PEP filed called "Abolish print in python 4" ? > I dont remember filing any such... You screamed "NO PRINT" at us in the voice of Edna Mode. (At least, that's how I imagined it being said. YMMV.) > Perhaps you should think of the

Re: Python is going to be hard

2014-09-03 Thread Rustom Mody
On Thursday, September 4, 2014 9:37:05 AM UTC+5:30, Ethan Furman wrote: > Ridiculous argument after ridiculous argument. Please do not waste our time > with nonsense. See my answer (3.) to Chris above. -- https://mail.python.org/mailman/listinfo/python-list

Re: Python is going to be hard

2014-09-03 Thread Rustom Mody
On Thursday, September 4, 2014 9:20:02 AM UTC+5:30, Chris Angelico wrote: > On Thu, Sep 4, 2014 at 1:22 PM, Rustom Mody wrote: > > | Effect-free programming > > | -- Function calls have no side effects, facilitating compositional > > reasoning > > | -- Variables are immutable, preventing unexpect

Re: Python is going to be hard

2014-09-03 Thread Ethan Furman
On 09/03/2014 08:22 PM, Rustom Mody wrote: On Thursday, September 4, 2014 7:26:56 AM UTC+5:30, Chris Angelico wrote: On Thu, Sep 4, 2014 at 11:48 AM, Rustom Mody wrote: NO PRINT Yes, or the OP could work with actual saved .py files and the reliability that comes from predictable execution e

Re: Python is going to be hard

2014-09-03 Thread Chris Angelico
On Thu, Sep 4, 2014 at 1:22 PM, Rustom Mody wrote: > | Effect-free programming > | -- Function calls have no side effects, facilitating compositional reasoning > | -- Variables are immutable, preventing unexpected changes to program data > by other code > | -- Data can be freely aliased or copied

Re: Python is going to be hard

2014-09-03 Thread Rustom Mody
On Thursday, September 4, 2014 7:26:56 AM UTC+5:30, Chris Angelico wrote: > On Thu, Sep 4, 2014 at 11:48 AM, Rustom Mody wrote: > NO PRINT > Yes, or the OP could work with actual saved .py files and the > reliability that comes from predictable execution environments... and > use print. Why

Re: Python is going to be hard

2014-09-03 Thread Rustom Mody
On Thursday, September 4, 2014 7:56:31 AM UTC+5:30, Chris Angelico wrote: > On Thu, Sep 4, 2014 at 12:10 PM, Rustom Mody wrote: > > On Thursday, September 4, 2014 7:26:56 AM UTC+5:30, Chris Angelico wrote: > >> On Thu, Sep 4, 2014 at 11:48 AM, Rustom Mody wrote: > >> NO PRINT > >> Why are you

Re: Python is going to be hard

2014-09-03 Thread Chris Angelico
On Thu, Sep 4, 2014 at 12:10 PM, Rustom Mody wrote: > On Thursday, September 4, 2014 7:26:56 AM UTC+5:30, Chris Angelico wrote: >> On Thu, Sep 4, 2014 at 11:48 AM, Rustom Mody wrote: >> NO PRINT > > >> Why are you so dead against print? > > Because it heralds a typical noob code-smell > [espe

Re: Python is going to be hard

2014-09-03 Thread Steven D'Aprano
Seymore4Head wrote: > Ok, I understand now that x is actually the first item in the list. > What I want is a loop that goes from 1 to the total number of items in > the list steve. 99% of the time, you don't want that at all. Trust me, iterating over the values in the list is *nearly* always the

Re: Python is going to be hard

2014-09-03 Thread Rustom Mody
On Thursday, September 4, 2014 7:26:56 AM UTC+5:30, Chris Angelico wrote: > On Thu, Sep 4, 2014 at 11:48 AM, Rustom Mody wrote: > NO PRINT > Why are you so dead against print? Because it heralds a typical noob code-smell [especially when the OP admits that BASIC is his background] > Yes,

Re: Python is going to be hard

2014-09-03 Thread Chris Angelico
On Thu, Sep 4, 2014 at 11:48 AM, Rustom Mody wrote: NO PRINT Yes, or the OP could work with actual saved .py files and the reliability that comes from predictable execution environments... and use print. Why are you so dead against print? ChrisA -- https://mail.python.org/mailman/listinfo/

Re: Python is going to be hard

2014-09-03 Thread Rustom Mody
On Wednesday, September 3, 2014 11:41:27 PM UTC+5:30, Seymore4Head wrote: > import math > import random > import sys > b=[] > steve = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] > for x in steve: > print (steve[x]) > Traceback (most recent call last): > print (steve[x]) > IndexError: list index

Re: Python is going to be hard

2014-09-03 Thread mm0fmf
On 03/09/2014 19:52, Seymore4Head wrote: I see that now. Thanks Maybe some comments in your code would help you? And also posting an on-topic title would help too. -- https://mail.python.org/mailman/listinfo/python-list

Re: Python is going to be hard

2014-09-03 Thread Denis McMahon
On Wed, 03 Sep 2014 14:10:42 -0400, Seymore4Head wrote: > import math import random import sys b=[] > steve = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] > for x in steve: > print (steve[x]) > > Traceback (most recent call last): > File "C:\Functions\blank.py", line 7, in > print (steve[x])

Re: Python is going to be hard

2014-09-03 Thread Ethan Furman
On 09/03/2014 11:41 AM, Seymore4Head wrote: On Wed, 03 Sep 2014 11:33:46 -0700, Ethan Furman wrote: Python will be incredibly hard if you don't read any of the docs or tutorials available. You can't accuse me of that. I have actually read quite a bit. I may not be picking it up, but I am t

Re: Python is going to be hard

2014-09-03 Thread Seymore4Head
On Wed, 3 Sep 2014 13:11:51 -0600, Ian Kelly wrote: >On Wed, Sep 3, 2014 at 12:49 PM, Seymore4Head > wrote: >> On Wed, 03 Sep 2014 14:10:42 -0400, Seymore4Head >> wrote: >> >>>import math >>>import random >>>import sys >>>b=[] >>>steve = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] >>>for x in steve:

Re: Python is going to be hard

2014-09-03 Thread Ian Kelly
On Wed, Sep 3, 2014 at 12:49 PM, Seymore4Head wrote: > On Wed, 03 Sep 2014 14:10:42 -0400, Seymore4Head > wrote: > >>import math >>import random >>import sys >>b=[] >>steve = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] >>for x in steve: >>print (steve[x]) >> >>Traceback (most recent call last): >>

Re: Python is going to be hard

2014-09-03 Thread Rob Gaddi
On Wed, 03 Sep 2014 11:55:13 -0700 Ethan Furman wrote: > On 09/03/2014 11:49 AM, Seymore4Head wrote: > > On Wed, 03 Sep 2014 14:10:42 -0400, Seymore4Head > > wrote: > > > >> import math > >> import random > >> import sys > >> b=[] > >> steve = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] > >> for x in

Re: Python is going to be hard

2014-09-03 Thread Seymore4Head
On Wed, 3 Sep 2014 15:44:47 -0300, Juan Christian wrote: >I'm learning Python using this mailist, and the Tutor mailist, reading the >docs and watching this course, Python Fundamentals ( >http://www.pluralsight.com/training/Courses/TableOfContents/python-fundamentals >). > >Python is really easy

Re: Python is going to be hard

2014-09-03 Thread Ethan Furman
On 09/03/2014 11:49 AM, Seymore4Head wrote: On Wed, 03 Sep 2014 14:10:42 -0400, Seymore4Head wrote: import math import random import sys b=[] steve = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] for x in steve: print (steve[x]) Traceback (most recent call last): File "C:\Functions\blank.py",

Re: Python is going to be hard

2014-09-03 Thread Seymore4Head
On Wed, 3 Sep 2014 13:28:39 -0500, Skip Montanaro wrote: >On Wed, Sep 3, 2014 at 1:24 PM, MRAB wrote: >> Iterating over a list yields its contents, not indexes. > >Unlike in JavaScript. Not sure where the OP is coming from, but that >"feature" of JavaScript threw me when I first encountered it.

Re: Python is going to be hard

2014-09-03 Thread Seymore4Head
On Wed, 3 Sep 2014 18:17:27 + (UTC), John Gordon wrote: >In Seymore4Head > writes: > >> import math >> import random >> import sys > >Why are you importing these modules if they're not used? > >> b=[] > >Likewise b is not used. > >> steve = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] >> for x in

Re: Python is going to be hard

2014-09-03 Thread Seymore4Head
On Wed, 3 Sep 2014 11:19:04 -0700, Rob Gaddi wrote: >On Wed, 03 Sep 2014 14:10:42 -0400 >Seymore4Head wrote: > >> import math >> import random >> import sys >> b=[] >> steve = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] >> for x in steve: >> print (steve[x]) >> >> Traceback (most recent call las

Re: Python is going to be hard

2014-09-03 Thread Seymore4Head
On Wed, 03 Sep 2014 14:10:42 -0400, Seymore4Head wrote: >import math >import random >import sys >b=[] >steve = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] >for x in steve: >print (steve[x]) > >Traceback (most recent call last): > File "C:\Functions\blank.py", line 7, in >print (steve[x]) >In

Re: Python is going to be hard

2014-09-03 Thread Juan Christian
I'm learning Python using this mailist, and the Tutor mailist, reading the docs and watching this course, Python Fundamentals ( http://www.pluralsight.com/training/Courses/TableOfContents/python-fundamentals ). Python is really easy and useful, OP don't blame the language because you didn't unders

Re: Python is going to be hard

2014-09-03 Thread Seymore4Head
On Wed, 03 Sep 2014 11:33:46 -0700, Ethan Furman wrote: >On 09/03/2014 11:10 AM, Seymore4Head wrote: >> import math >> import random >> import sys >> b=[] >> steve = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] >> for x in steve: >> print (steve[x]) >> >> Traceback (most recent call last): >>F

Re: Python is going to be hard

2014-09-03 Thread Ethan Furman
On 09/03/2014 11:10 AM, Seymore4Head wrote: import math import random import sys b=[] steve = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] for x in steve: print (steve[x]) Traceback (most recent call last): File "C:\Functions\blank.py", line 7, in print (steve[x]) IndexError: list index

Re: Python is going to be hard

2014-09-03 Thread Skip Montanaro
On Wed, Sep 3, 2014 at 1:24 PM, MRAB wrote: > Iterating over a list yields its contents, not indexes. Unlike in JavaScript. Not sure where the OP is coming from, but that "feature" of JavaScript threw me when I first encountered it. My guess would be that his prior experience includes (at least)

Re: Python is going to be hard

2014-09-03 Thread John Gordon
In Seymore4Head writes: > import math > import random > import sys Why are you importing these modules if they're not used? > b=[] Likewise b is not used. > steve = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] > for x in steve: > print (steve[x]) As you step through the loop, x becomes each

Re: Python is going to be hard

2014-09-03 Thread MRAB
On 2014-09-03 19:10, Seymore4Head wrote: import math import random import sys b=[] steve = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] for x in steve: print (steve[x]) Traceback (most recent call last): File "C:\Functions\blank.py", line 7, in print (steve[x]) IndexError: list index out

Re: Python is going to be hard

2014-09-03 Thread Rob Gaddi
On Wed, 03 Sep 2014 14:10:42 -0400 Seymore4Head wrote: > import math > import random > import sys > b=[] > steve = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] > for x in steve: > print (steve[x]) > > Traceback (most recent call last): > File "C:\Functions\blank.py", line 7, in > print (ste

Re: Python is going to be hard

2014-09-03 Thread Rock Neurotiko
print(x) :) 2014-09-03 20:10 GMT+02:00 Seymore4Head : > import math > import random > import sys > b=[] > steve = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] > for x in steve: > print (steve[x]) > > Traceback (most recent call last): > File "C:\Functions\blank.py", line 7, in > print (ste

Python is going to be hard

2014-09-03 Thread Seymore4Head
import math import random import sys b=[] steve = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] for x in steve: print (steve[x]) Traceback (most recent call last): File "C:\Functions\blank.py", line 7, in print (steve[x]) IndexError: list index out of range -- https://mail.python.org/mailman/