Re: [Tutor] for loop

2009-04-16 Thread W W
On Thu, Apr 16, 2009 at 3:45 PM, mbikinyi brat wrote: > Dear ALL, > I am a beginner in python and I just copied the code in blue below and > execute and had the result in green. Then I thought *letter* should be a > special word in python. Then I now replace letter whith *chic* and yet > the same

Re: [Tutor] for loop

2009-04-16 Thread R. Alan Monroe
for letter in "python": >  print "Current letter:", letter for chic in "python": >  print "chic:", chic When you write a for-in loop, you can use any variable name you feel like using (letter, chic, mycoolvariable, x, etc.) It's that simple :) Alan __

Re: [Tutor] list to string and string to list

2009-04-16 Thread Martin Walsh
Martin Walsh wrote: > johnf wrote: >> On Thursday 16 April 2009 05:04:39 pm Alan Gauld wrote: >>> "johnf" wrote >>> > I want to save the list to the field and when I retrieve the string > convert > it back to a list. > > But this does NOT work. > mylist=[1,2,3,4] > myst

Re: [Tutor] list to string and string to list

2009-04-16 Thread Martin Walsh
johnf wrote: > On Thursday 16 April 2009 05:04:39 pm Alan Gauld wrote: >> "johnf" wrote >> I want to save the list to the field and when I retrieve the string convert it back to a list. But this does NOT work. mylist=[1,2,3,4] mystr=str(mylist) newlist=

Re: [Tutor] list to string and string to list

2009-04-16 Thread johnf
On Thursday 16 April 2009 05:04:39 pm Alan Gauld wrote: > "johnf" wrote > > >> I want to save the list to the field and when I retrieve the string > >> convert > >> it back to a list. > >> > >> But this does NOT work. > >> mylist=[1,2,3,4] > >> mystr=str(mylist) > >> > >> newlist= list(mystr) > >>

Re: [Tutor] list to string and string to list

2009-04-16 Thread Alan Gauld
"johnf" wrote I want to save the list to the field and when I retrieve the string convert it back to a list. But this does NOT work. mylist=[1,2,3,4] mystr=str(mylist) newlist= list(mystr) I keep thinking there must be a simple way of get this done. Is this a good way? newlist = eval(mys

Re: [Tutor] list to string and string to list

2009-04-16 Thread Kent Johnson
On Thu, Apr 16, 2009 at 6:52 PM, johnf wrote: > I am dealing with a database field that can only store strings. > I want to save the list to the field and when I retrieve the string convert it > back to a list. > > But this does NOT work. > mylist=[1,2,3,4] > mystr=str(mylist) > > newlist= list(my

Re: [Tutor] Here's something to talk about

2009-04-16 Thread Ricardo Aráoz
Weidner, Ronald wrote: > One of your points represents a great opportunity to make mine. Suppose > this code is several years old. Now we have a new requirement that > states we need to work with the data as you described above. How > much of the existing code would you have to change to make th

Re: [Tutor] list to string and string to list

2009-04-16 Thread johnf
On Thursday 16 April 2009 03:52:02 pm johnf wrote: > I am dealing with a database field that can only store strings. > I want to save the list to the field and when I retrieve the string convert > it back to a list. > > But this does NOT work. > mylist=[1,2,3,4] > mystr=str(mylist) > > newlist= lis

[Tutor] list to string and string to list

2009-04-16 Thread johnf
I am dealing with a database field that can only store strings. I want to save the list to the field and when I retrieve the string convert it back to a list. But this does NOT work. mylist=[1,2,3,4] mystr=str(mylist) newlist= list(mystr) I keep thinking there must be a simple way of get this d

Re: [Tutor] beginners resources list, Python education events

2009-04-16 Thread Alan Gauld
"wesley chun" wrote i'm trying to collate a complete newbie-to-programming list of resources and was wondering if you could help me fill in the holes... thx in advance! What about the free (and even the pay for) videos on the ShowMeDo site. I thought they were pretty good especially for sh

Re: [Tutor] importance of Docstring

2009-04-16 Thread wesley chun
def f(x): > > '''f(x) -> x+5''' > return x+5 > help(f) > > Help on function f in module __main__: > > f(x) >   f(x) -> x+5 another thing that has not been mentioned is that if you put docstrings everywhere, you can use tools like Epydoc, doxygen, or sphinx to generate full documentation

Re: [Tutor] beginners resources list, Python education events

2009-04-16 Thread Gregor Lingl
wesley chun schrieb: hey all, ... Python: Visual QuickStart Guide (Fehily, 2001) This is outdated. There is a new one: Toby Donaldson: Python: Visual QuickStart Guide (2008) Learn to Program Using Python (Gauld, 2000) ONLINE How to Think like a Computer Scientist http://openbookproject

Re: [Tutor] for loop

2009-04-16 Thread Alan Gauld
"mbikinyi brat" wrote Then I thought letter should be a special word in python. Why did you think that? Python has a very specific (and small) set of keywords that have special meaning - things like for, while and print But you can call variables pretty much whatever you like and Python

Re: [Tutor] beginners resources list, Python education events

2009-04-16 Thread Alan Gauld
"wesley chun" wrote Alan Gauld's Learning to Program http://www.freenetpages.co.uk/hp/alan.gauld Now at: http://www.alan-g.me.uk/ for Python v2.x http://www.alan-g.me.uk/l2p for Python v3 and under construction, although well on th

Re: [Tutor] print output

2009-04-16 Thread Alan Gauld
"mbikinyi brat" wrote I have defined variables as below and when I call them using the print function, I have something discontinous as in pink colour. How do I call it so that my output should be as in blue print counter 101 print miles 1000 print name joe This is because you are u

Re: [Tutor] Building VST's with Python

2009-04-16 Thread Alan Gauld
"Logan Thomas" wrote I'm new to python but do have a little programming knowledge with C++I got into programming so I could build Virtual Instruments because I love the world of sound and creating instruments that shape it..I was wondering if you could direct me to some tutorials or sour

Re: [Tutor] importance of Docstring

2009-04-16 Thread Alan Gauld
"mbikinyi brat" wrote What is really the importance of Docstring in Python??? Some really great comments about comments, however the significance of docstrings beyond normal comments is that tools like help() work with them Thus: def f(x): '''f(x) -> x+5''' return x+5 help(f) Help

Re: [Tutor] beginners resources list, Python education events

2009-04-16 Thread David
wesley chun wrote: hey all, i'm trying to collate a complete newbie-to-programming list of resources and was wondering if you could help me fill in the holes... thx in advance! Hi wesley, A couple I liked; One Day of IDLE Toying http://hkn.eecs.berkeley.edu/~dyoo/python/idle_intro/index.html

Re: [Tutor] for loop

2009-04-16 Thread Emile van Sebille
mbikinyi brat wrote: Dear ALL, I am a beginner in python and I just copied the code in blue below and execute and had the result in green. Then I thought *letter* should be a special word in python. Then I now replace letter whith *chic* and yet the same results is obtained. of course -- c

[Tutor] for loop

2009-04-16 Thread mbikinyi brat
Dear ALL, I am a beginner in python and I just copied the code in blue below and execute and had the result in green. Then I thought letter should be a special word in python. Then I now replace letter whith chic  and yet the same results is obtained. I cannot reconcile them. Can someone explain

[Tutor] beginners resources list, Python education events

2009-04-16 Thread wesley chun
hey all, i'm trying to collate a complete newbie-to-programming list of resources and was wondering if you could help me fill in the holes... thx in advance! BOOKS Python Programming for the Absolute Beginner (Dawson, 2005) Python For Dummies (Maruch, Maruch, 2006) Python Programming: An Introduc

Re: [Tutor] print output

2009-04-16 Thread Dave Angel
mbikinyi brat wrote: Dear ALL, I have defined variables as below and when I call them using the print function, I have something discontinous as in pink colour. How do I call it so that my output should be as in blue counter=101 miles=1000 name="joe" print counter

Re: [Tutor] print output

2009-04-16 Thread vishwajeet singh
try this print str(counter) + "\n" + str(miles) + "\n"+ name On Thu, Apr 16, 2009 at 11:24 PM, mbikinyi brat wrote: > ** > *Dear ALL,* > I have defined variables as below and when I call them using the print > function, I have something discontinous as in pink colour. How do I call it > so that m

Re: [Tutor] print items in a list...

2009-04-16 Thread Kent Johnson
On Thu, Apr 16, 2009 at 1:37 PM, Spencer Parker wrote: > I have a script that is putting elements into a list.  Now instead of adding > a for blah in blah statement...is there an easy way to print out the > elements in a list that is similar to this?  I don't have an absolute length > on the size

[Tutor] Fwd: Import Modules

2009-04-16 Thread Kent Johnson
Forwarding to the list -- Forwarded message -- From: GG Labs 10 Date: Thu, Apr 16, 2009 at 10:28 AM Subject: Re: [Tutor] Import Modules To: Kent Johnson Thankyou, i think i've understood the problem. Now, another App Engine related question: This code: --- import google p

[Tutor] print output

2009-04-16 Thread mbikinyi brat
  Dear ALL, I have defined variables as below and when I call them using the print function, I have something discontinous as in pink colour. How do I call it so that my output should be as in blue >>> counter=101 >>> miles=1000 >>> name="joe" >>> print counter 101 >>> print miles 1000 >>> print

Re: [Tutor] print items in a list...

2009-04-16 Thread spir
Le Thu, 16 Apr 2009 11:37:35 -0600, Spencer Parker s'exprima ainsi: > trying to clean up > messy code for the most part How does it look like? Denis -- la vita e estrany ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listin

[Tutor] PyCon Videos

2009-04-16 Thread Martin Walsh
Hi All, Not sure if it's common knowledge, particularly for those who didn't make it to PyCon this year, but all of the talks were recorded and will be available online in good time, thanks to Carl Karsten and his merry band of A/V volunteers. I can't even begin to grasp how much work is required

[Tutor] print items in a list...

2009-04-16 Thread Spencer Parker
I have a script that is putting elements into a list. Now instead of adding a for blah in blah statement...is there an easy way to print out the elements in a list that is similar to this? I don't have an absolute length on the size of the list either since it changes depending on what I am searc

Re: [Tutor] importance of Docstring

2009-04-16 Thread python
Albert, That was a great writeup on docstrings. I'm going to share that with my dev team. Thank you! Malcolm ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] code publishing

2009-04-16 Thread Kent Johnson
On Thu, Apr 16, 2009 at 6:59 AM, spir wrote: > Hello, > > I have no clue whether there is a common place to publish some (free like the > air) python source code for review, use, evolution... > (It's about 17 5kb.) If you just want a temporary place to put it for comments then pastebin is good.

Re: [Tutor] code publishing

2009-04-16 Thread Sander Sweers
2009/4/16 spir : > I have no clue whether there is a common place to publish some (free like the > air) python source code for review, use, evolution... > (It's about 17 5kb.) Maybe http://python.pastebin.com is what you are looking for? Greets Sander

[Tutor] Building VST's with Python

2009-04-16 Thread Logan Thomas
I'm new to python but do have a little programming knowledge with C++I got into programming so I could build Virtual Instruments because I love the world of sound and creating instruments that shape it...I have tried to find a program that would be an ideal vehicle for this task...I've narrowed

[Tutor] code publishing

2009-04-16 Thread spir
Hello, I have no clue whether there is a common place to publish some (free like the air) python source code for review, use, evolution... (It's about 17 5kb.) Denis -- la vita e estrany ___ Tutor maillist - Tutor@python.org http://mail.python.or

[Tutor] bootstrapping

2009-04-16 Thread spir
Hello, This question is rather intended to people who have some knowledge on parser generation and/or on self-compiling languages. I have a custom PEG parser generator in python, called 'pijnu', just bootstrapped. Meaning it's a kind of specific language which generator (compiler) is able to pr

Re: [Tutor] Import Modules

2009-04-16 Thread Kent Johnson
On Thu, Apr 16, 2009 at 3:21 AM, ALAN GAULD wrote: > > >> In general, importing a package does not give access to members of a >> sub-package. > > Interestingly I added the comment about sub packages specifically > because I remembered os.path and assumed it was the norm! :-) Yes, it took me a lo

Re: [Tutor] importance of Docstring

2009-04-16 Thread A.T.Hofkamp
mbikinyi brat wrote: Dear ALL, What is really the importance of Docstring in Python??? Regards, Henry The same as comments, except at function, class, and module level. In addition, Python provides hooks for extracting that information, and eg put it in a document such as the standardlib docu

Re: [Tutor] importance of Docstring

2009-04-16 Thread spir
Le Thu, 16 Apr 2009 02:04:25 -0700 (PDT), mbikinyi brat s'exprima ainsi: > Dear ALL, > What is really the importance of Docstring in Python??? > Regards, > Henry Very very very great, I guess ;-) Denis -- la vita e estrany ___ Tutor maillis

[Tutor] importance of Docstring

2009-04-16 Thread mbikinyi brat
Dear ALL, What is really the importance of Docstring in Python??? Regards, Henry ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Import Modules

2009-04-16 Thread ALAN GAULD
> In general, importing a package does not give access to members of a > sub-package. You have to explicitly import the subpackage. For > example, > > In [1]: import xml > In [2]: xml.dom.Node > --- > AttributeError