I am out of trial and error again Lists
rustompmody at gmail.com
Sat Oct 25 05:46:57 CEST 2014
On Saturday, October 25, 2014 5:21:01 AM UTC+5:30, Seymore4Head wrote:
> On Fri, 24 Oct 2014 16:27:58 -0700 (PDT), Rustom Mody wrote:
> >On Saturday, October 25, 2014 4:30:47 AM UTC+5:30, Seymore4Head wrote:
> >> On Wed, 22 Oct 2014 16:30:37 -0400, Seymore4Head wrote:
> >> name="123-xyz-abc"
> >> a=range(10)
> >> b=list(range(10))
> >> c=str(list(range(10)))
> >> print ("a",(a))
> >> print ("b",(b))
> >> print ("c",(c))
> >> for x in name:
> >> if x in a:
> >> print ("a",(x))
> >> if x in b:
> >> print ("b",(x))
> >> if x in c:
> >> print ("c",(x))
> >> B is type list and C is type str.
> >> I guess I am still a little too thick. I would expect b and c to
> >> work.
> >Lets simplify the problem a bit.
> >Do all the following in interpreter window
> >>>> name="012"
> >>>> b=list(range(3))
> >>>> for x in name: print x
> >>>> for x in b: print x
> >Same or different?
> >Now go back to Denis' nice example and put in type(x)
> >into each print
> >Same or different?
> First. The interpreter is not good for me to use even when I am using
> Python 3 because I forget to add : and I forget to put () around the
> print statements.
What would you say to a person who
- Buys a Lambhorgini
- Hitches a horse (or bullock) to it
- Moans how clumsily slow it is.
In case you dont get it:
- the interpreter is one of the factors that puts python into the hi-end class.
- the bullock/horse class is the C/Java type language where you always
need to work through files
Here is my list of points of sliding for bullock category to Lambhorgini:
['Interpreter' is called 'REPL' there]
> To keep me from having to correct myself every time I use it, it is
> just easier to make a short py file.
Yes the intention is right, The implementation is wrong.
Programmers consider it a virtue to be lazy.
But you have to put it some work to learn to be lazy in an effective way
And currently you are being lazy on the wrong front.
1. A good programmer tries out things at the interpreter ONE LINE AT A TIME
2. What he tries out are usually EXPRESSIONS like eg
And not STATEMENTS like
if x in name:
3. IOW a good programmer rarely needs to type a colon at the interpreter
4. The least useful statement to try at the interpreter is print.
More information about the Python-list