[Tutor] Tutor FAQ

2006-05-17 Thread Mike Hansen
Here's a small batch of questions/answers for the tutor FAQ.

Let me know if you have any corrections or clarifications. I'll post 
them to the web site in a couple of days.

Mike

-
How much code should I post?

Post as much relevent code as you can. However, the consensus seems to 
be that the more code you post, the less likely you'll get someone to 
review it. A max of 100 lines is suggested. If you have more code, you 
might post your code at
http://www.rafb.net/paste or a similar site.

-
How do I dynamically name my objects? How do I name my objects based on 
user input?

Rather than performing voodoo by dynamically creating variables, your 
best bet is to use a dictionary with the keys being the name of the 
object or user input and the values being the objects.

-
Why doesn't my special method add, init, or cmp.. work?

Remember to use two underscores before and after the method name 
__add__, __init__, __cmp__.

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Tutor FAQ

2006-05-03 Thread Mike Hansen
Well, I posted a few questions to http://pyfaq.infogami.com/tutor-index 
late last week. Since the next questions and answers are a bit on the 
long side, I'll send them to this list in multiple messages. Please let 
me know if you have any corrections or clarifications. Below is a 
reworked question from last week.

-
How do I make public and private attributes and methods in my classes?

Python followws the philosophy of we're all adults here with respect 
to hiding attributes and methods. i.e. trust the other programmers who 
will use your classes. You should use plain attributes whenever 
possible.

You might be tempted to use getters and setters, but the only reason to 
use getters and setters is so you can change the implementation later 
if you need to.  However, Python
allows you to do this with properties

http://www.python.org/download/releases/2.2.3/descrintro/#property

If you really must hide an attribute or method, Python does do name 
mangling. By putting two underscores before the attribute or method 
name and not putting two underscores after the name, Python will mangle 
the name by putting the class name in front of it.

For an short example see
http://en.wikipedia.org/wiki/Name_mangling#Name_mangling_in_Python

[Paraphrased from a post to comp.lang.python by Steven Bethard]

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Tutor FAQ

2006-05-03 Thread Mike Hansen
-
What's the difference between import foo and from foo import *?

import sys

This brings the *name* sys into your module.
It does not give you access to any of the names inside sys itself (such 
as
exit for example). To access those you need to prefix them with sys, as 
in

sys.exit()

from sys import *

This does NOT bring the name sys into your module, instead it brings 
all
of the names inside sys(like exit for example) into your module. Now 
you can
access those names without a prefix, like this:

exit()

So why not do that instead of

import sys?

The reason is that the second form will overwrite and names you have 
already
declared - like exit say.
exit = 42
from sys import *   # hides my exit variable.

OR more likely, the other way round

from sys import *
exit = 42   # now hides the sys.exit function so I can't use it.

Of course some of these are obvious but there can be a lot of names in a
module, and some modules have the same name in them, for example:

from os import *
from urllib import *

open(foo)   # which open gets called, os.open or urllib.open?

Can you see how it gets confusing.
Bottom line is it is usually better to accept the extra typing and use

import foo

or for just a few names

from foo import bar,baz

[from a post on Python Tutor by Alan Gauld]

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Tutor FAQ

2006-05-03 Thread Mike Hansen
I need some help with this question and answer. It appears that useless 
Python is gone. uselesspython.com. Is it still around? Does anyone have 
any ideas on this one?

-
I'm learning Python. What should I program?

If you have a personal itch to scratch, it's probably best to scratch 
it. You'll probably be more interested and motivated to program if it's 
something you want to accomplish.

However, if you don't have any ideas, you can try the Python Challenge
http://www.pythonchallenge.com/

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Tutor FAQ

2006-05-03 Thread Mike Hansen
-
What are some good books on Python?

See the Python wiki http://wiki.python.org/moin/PythonBooks or search 
comp.lang.python or the tutor archives since this is a very frequently 
asked.

If you have no programming experience, try Alan Gauld's book
Learn To Program http://www.freenetpages.co.uk/hp/alan.gauld/

If you have some programming experience try
Learning Python http://www.oreilly.com/catalog/lpython2/index.html
Dive Into Python http://diveintopython.org/
Beginning Python: From Novice to Professional  
http://www.apress.com/book/bookDisplay.html?bID=10013
Core Python Programming  http://starship.python.net/crew/wesc/cpp/

Good Python reference books are
The Essential Python Reference 
http://www.samspublishing.com/title/0672328623
Python in a Nutshell http://www.oreilly.com/catalog/pythonian/index.html
Python Cookbook http://www.oreilly.com/catalog/pythoncook2/

A note to Perl programmers who are learning Python. Don't start with 
Programming Python. It is not the same as Programming Perl. Start with 
Learning Python, then move on to Programming Python.

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Tutor FAQ

2006-05-03 Thread Mike Hansen
-
What is if __name__ == __main__ for?

The 'if __name__ == __main__:  ... trick exists in Python so that our
Python files can act as either reusable modules, or as standalone
programs.  As a toy example, let's say that we have two files:

##
mumak:~ dyoo$ cat mymath.py
def square(x):
 return x * x

if __name__ == '__main__':
 print test: square(42) ==, square(42)


mumak:~ dyoo$ cat mygame.py
import mymath

print this is mygame.
print mymath.square(17)
##

In this example, we've written mymath.py to be both used as a utility
module, as well as a standalone program.  We can run mymath standalone 
by
doing this:

##
mumak:~ dyoo$ python mymath.py
test: square(42) == 1764
##


But we can also use mymath.py as a module; let's see what happens when 
we
run mygame.py:

##
mumak:~ dyoo$ python mygame.py
this is mygame.
289
##

Notice that here we don't see the 'test' line that mymath.py had near 
the
bottom of its code.  That's because, in this context, mymath is not the
main program.  That's what the 'if __name__ == __main__: ...' trick is
used for.

[From a post to Python Tutor by Danny Woo]

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Tutor FAQ

2006-05-03 Thread Kent Johnson
Mike Hansen wrote:
 -
 What's the difference between import foo and from foo import *?
 
 import sys
 
 This brings the *name* sys into your module.
(Technically, it binds the name sys to the object that is the sys module.)
 It does not give you access to any of the names inside sys itself (such 
 as

does not give you _direct_ access...
 exit for example). To access those you need to prefix them with sys, as 
 in
 
 sys.exit()
 
 from sys import *
 
 This does NOT bring the name sys into your module, instead it brings 
 all
 of the names inside sys(like exit for example) into your module. Now 
 you can
 access those names without a prefix, like this:
 
 exit()
 
 So why not do that instead of
 
 import sys?
 
 The reason is that the second form will overwrite and names you have 
 already
 declared - like exit say.
 exit = 42
 from sys import *   # hides my exit variable.
 
 OR more likely, the other way round
 
 from sys import *
 exit = 42   # now hides the sys.exit function so I can't use it.
 
 Of course some of these are obvious but there can be a lot of names in a
 module, and some modules have the same name in them, for example:
 
 from os import *
 from urllib import *
 
 open(foo)   # which open gets called, os.open or urllib.open?
 
 Can you see how it gets confusing.
confusing?

Another disadvantage of from sys import * is that it makes it harder 
to find the definition of a name. If you see sys.exit() in the code, 
you know exactly where exit() is defined. If you see exit() in a 
module that has several from xx import * statements, you will have to 
search each imported module for the definition of exit().

 Bottom line is it is usually better to accept the extra typing and use
The bottom line...
 
 import foo
 
 or for just a few names
 
 from foo import bar,baz
 
 [from a post on Python Tutor by Alan Gauld]
 
 ___
 Tutor maillist  -  Tutor@python.org
 http://mail.python.org/mailman/listinfo/tutor
 
 


___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Tutor FAQ

2006-05-03 Thread Kent Johnson
Mike Hansen wrote:
 -
 What are some good books on Python?
 
 See the Python wiki http://wiki.python.org/moin/PythonBooks or search 
 comp.lang.python or the tutor archives since this is a very frequently 
 asked.
 
 If you have no programming experience, try Alan Gauld's book
 Learn To Program http://www.freenetpages.co.uk/hp/alan.gauld/
Python Programming for the absolute beginner 
http://premierpressbooks.com/ptr_detail.cfm?isbn=1%2D59863%2D112%2D8
Python Programming: An Introduction to Computer Science 
http://www.fbeedle.com/99-6.html

 
 If you have some programming experience try
 Learning Python http://www.oreilly.com/catalog/lpython2/index.html
 Dive Into Python http://diveintopython.org/
 Beginning Python: From Novice to Professional  
 http://www.apress.com/book/bookDisplay.html?bID=10013
 Core Python Programming  http://starship.python.net/crew/wesc/cpp/
 
 Good Python reference books are
 The Essential Python Reference 
 http://www.samspublishing.com/title/0672328623
 Python in a Nutshell http://www.oreilly.com/catalog/pythonian/index.html
 Python Cookbook http://www.oreilly.com/catalog/pythoncook2/
 
 A note to Perl programmers who are learning Python. Don't start with 
 Programming Python. It is not the same as Programming Perl. Start with 
 Learning Python, then move on to Programming Python.
 
 ___
 Tutor maillist  -  Tutor@python.org
 http://mail.python.org/mailman/listinfo/tutor
 
 


___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Tutor FAQ

2006-04-27 Thread Alan Gauld
 Py2exe makes an executable of your Python program. For Windows only.
 http://sourceforge.net/projects/py2exe/
 

I believe Gordon McMillan's installer (now called pyInstaller) also makes 
Linux (and Irix!) executables so may be worth a link/mention here too. 

http://pyinstaller.hpcf.upr.edu/cgi-bin/trac.cgi

Although Linux users seem far less likely to want/need to create 
standalone executables.

Alan G.
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Tutor FAQ

2006-04-26 Thread Mike Hansen
Here's the next batch of questions and answers for the tutor FAQ. If  
you have any clarifications or corrections, please let me know. I'll  
try to post this on the web site in a couple of days.

-
How do I get data out of HTML?

Try Beautiful Soup.
http://www.crummy.com/software/BeautifulSoup/

Beautiful Soup is more forgiving than other parsers in that it won't  
choke on bad markup.

-
What's the best editor/IDE for Python?

It's really a matter of preference. There are many features of an  
editor or IDE such as syntax highlighting, code completion, code  
folding, buffers, tabs,  ... Each editor or IDE has some or all of  
these features, and you'll have to decide which features are important  
to you.
See http://wiki.python.org/moin/PythonEditors for a list of editors.
Also http://wiki.python.org/moin/IntegratedDevelopmentEnvironments has  
a list of IDEs.

-
How do I make public and private attributes and methods in my classes?

Python followws the philosophy of we're all adults here with respect  
to hiding attributes and methods. i.e. trust the other programmers who  
will use your classes. You can't really hide variables and methods in  
Python. You can give clues to other programmers. Python does do name  
mangling. By putting two underscores before the attribute or method  
name and not putting two underscores after the name, Python will mangle  
the name by putting the class name in front of it.

For an short example see
http://en.wikipedia.org/wiki/Name_mangling#Name_mangling_in_Python

-
Why doesn't my regular expression work?

Typically, it's an isssue between re.match and re.search. Match matches  
the beginning only and search checks the entire string. See the regular  
expression HOWTO for more details.

http://www.amk.ca/python/howto/regex/

-
How do I perform matrix operations using Python?

The Python FAQ has an entry on how to create multidimensional lists:
http://python.org/doc/faq/programming.html#how-do-i-create-a- 
multidimensional-list

You may want to look into the 'numarray' third party module:
http://www.stsci.edu/resources/software_hardware/numarray

-
How do I make an executable out of my Python program?

Although it isn't necessary to turn your Python programs into  
executables, many people want to be able to put their Python programs  
on other machines that don't have Python installed.

Py2exe makes an executable of your Python program. For Windows only.
http://sourceforge.net/projects/py2exe/

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Tutor FAQ

2006-04-26 Thread Kent Johnson
Mike Hansen wrote:
 Here's the next batch of questions and answers for the tutor FAQ. If  
 you have any clarifications or corrections, please let me know. I'll  
 try to post this on the web site in a couple of days.

Thanks Mike!

 -
 What's the best editor/IDE for Python?
 
 It's really a matter of preference. There are many features of an  
 editor or IDE such as syntax highlighting, code completion, code  
 folding, buffers, tabs,  ... Each editor or IDE has some or all of  
 these features, and you'll have to decide which features are important  
 to you.
 See http://wiki.python.org/moin/PythonEditors for a list of editors.
 Also http://wiki.python.org/moin/IntegratedDevelopmentEnvironments has  
 a list of IDEs.
This question is asked every few weeks on comp.lang.python so searching 
the archives will yield many opinions.
 
 -
 How do I make public and private attributes and methods in my classes?
 
 Python followws the philosophy of we're all adults here with respect  
 to hiding attributes and methods. i.e. trust the other programmers who  
 will use your classes. You can't really hide variables and methods in  
 Python. You can give clues to other programmers. 
By convention, a name that starts with a single underscore is an 
implementation detail that may change and should not be used by client code.
Python does do name
 mangling. By putting two underscores before the attribute or method  
 name and not putting two underscores after the name, Python will mangle  
 the name by putting the class name in front of it.
IMO this needs work but not by me tonight...
 
 For an short example see
 http://en.wikipedia.org/wiki/Name_mangling#Name_mangling_in_Python
 
 -
 Why doesn't my regular expression work?
 
 Typically, it's an isssue between re.match and re.search. Match matches  
 the beginning only and search checks the entire string. See the regular  
 expression HOWTO for more details.
 
 http://www.amk.ca/python/howto/regex/

Python comes with a handy program for testing regular expressions, 
Tools\Scripts\redemo.py.
 
 -
 How do I perform matrix operations using Python?
 
 The Python FAQ has an entry on how to create multidimensional lists:
 http://python.org/doc/faq/programming.html#how-do-i-create-a- 
 multidimensional-list
 
 You may want to look into the 'numarray' third party module:
 http://www.stsci.edu/resources/software_hardware/numarray
Numarray is being replaced with numpy - we should refer people there
You may want to look into the 'numpy' module which contains many 
resources for scientific computing including powerful matrix operations:
http://numeric.scipy.org/

Kent

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Tutor FAQ

2006-04-26 Thread Mike Hansen
Thanks Kent. I'll make those additions/corrections and rework the 
question about private and public attributes and methods.

Mike

On Apr 26, 2006, at 7:42 PM, Kent Johnson wrote:

 Mike Hansen wrote:
 Here's the next batch of questions and answers for the tutor FAQ. If
 you have any clarifications or corrections, please let me know. I'll
 try to post this on the web site in a couple of days.

 Thanks Mike!

 -
 What's the best editor/IDE for Python?

 It's really a matter of preference. There are many features of an
 editor or IDE such as syntax highlighting, code completion, code
 folding, buffers, tabs,  ... Each editor or IDE has some or all of
 these features, and you'll have to decide which features are important
 to you.
 See http://wiki.python.org/moin/PythonEditors for a list of editors.
 Also http://wiki.python.org/moin/IntegratedDevelopmentEnvironments has
 a list of IDEs.
 This question is asked every few weeks on comp.lang.python so searching
 the archives will yield many opinions.

 -
 How do I make public and private attributes and methods in my classes?

 Python followws the philosophy of we're all adults here with respect
 to hiding attributes and methods. i.e. trust the other programmers who
 will use your classes. You can't really hide variables and methods in
 Python. You can give clues to other programmers.
 By convention, a name that starts with a single underscore is an
 implementation detail that may change and should not be used by client 
 code.
 Python does do name
 mangling. By putting two underscores before the attribute or method
 name and not putting two underscores after the name, Python will 
 mangle
 the name by putting the class name in front of it.
 IMO this needs work but not by me tonight...

 For an short example see
 http://en.wikipedia.org/wiki/Name_mangling#Name_mangling_in_Python

 -
 Why doesn't my regular expression work?

 Typically, it's an isssue between re.match and re.search. Match 
 matches
 the beginning only and search checks the entire string. See the 
 regular
 expression HOWTO for more details.

 http://www.amk.ca/python/howto/regex/

 Python comes with a handy program for testing regular expressions,
 Tools\Scripts\redemo.py.

 -
 How do I perform matrix operations using Python?

 The Python FAQ has an entry on how to create multidimensional lists:
 http://python.org/doc/faq/programming.html#how-do-i-create-a-
 multidimensional-list

 You may want to look into the 'numarray' third party module:
 http://www.stsci.edu/resources/software_hardware/numarray
 Numarray is being replaced with numpy - we should refer people there
 You may want to look into the 'numpy' module which contains many
 resources for scientific computing including powerful matrix 
 operations:
 http://numeric.scipy.org/

 Kent

 ___
 Tutor maillist  -  Tutor@python.org
 http://mail.python.org/mailman/listinfo/tutor


___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Tutor FAQ?

2006-04-24 Thread Mike Hansen

On Apr 22, 2006, at 3:15 AM, Fredrik Lundh wrote:

 Ed wrote:

 I don't think the FAQ is open to public editing yet.  I'm not sure
 when it will be, but Fredrik might be able to give a timescale.

 There are a few known conversion issues to deal with (the FAQ uses
 a lot more looks like markdown syntax than the tutorial, which con-
 fused the converter).  I've made some progress, but it'll probably take
 another week before everything's sorted out.

 When Ed brought up the tutor/tutorial FAQ idea, my first thought
 was that Ed and other volunteers could add pages in a separate
 tutor- namespace (to avoid collisions with material from the
 existing FAQ), and ended up writing a couple of paragraphs on
 how to manually convert titles to page names.  When I found that
 I had written this isn't quite as hard as it may look, I realized
 that it would be better if I just wrote a script that did this.

 So, while I'm working on that script, I suggest that you start adding
 stuff the tutor suggestion page that I just set up:

 http://pyfaq.infogami.com/suggest-tutor

 One entry per comment; use ## title to mark the first line as the
 FAQ entry.  I've added Mike's examples.

 cheers /F


Hi,

I'll post the questions and answers to the list first. If I don't get 
any corrections or clarifications in a day or so after posting, I'll 
add it to the tutor suggestion page. Ed mentioned that you are using 
restructured text. Should I put the entry in restructured text? I spent 
some time last night reading up on restructured text and docutils.

Thanks,

Mike

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Tutor FAQ?

2006-04-24 Thread Fredrik Lundh
Mike Hansen wrote:

 I'll post the questions and answers to the list first. If I don't get
 any corrections or clarifications in a day or so after posting, I'll
 add it to the tutor suggestion page.

excellent!

 Ed mentioned that you are using restructured text. Should I put
 the entry in restructured text? I spent some time last night reading
 up on restructured text and docutils.

the infogami site uses markdown, which is a similar (but a bit simpler,
imo) syntax.  There's a very brief introduction on

   http://pyfaq.infogami.com/suggest-tutor

(which basically says that you should use ## to mark the entry title, and
indent all code snippets by at least four spaces)

and there's an on-line test editor here:

   http://daringfireball.net/projects/markdown/dingus

(that pages also contains a cheatsheet and links to full documentation).

When this is moved over to python.org, it'll either be handled as HTML
or converted to ReST (which is the main syntax used on python.org),
but that'll all be taken care of by tools.  The important thing now is to
get the content in place.

cheers /F
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Tutor FAQ?

2006-04-23 Thread Fredrik Lundh
 When Ed brought up the tutor/tutorial FAQ idea

and yes, I'll change tutorial FAQ to tutor FAQ, to make
things a bit less confusing.
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Tutor FAQ?

2006-04-22 Thread Ed Singleton
 Yep, I'm volunteering. Forgive my ignorance, but I couldn't seem to figure
 out how to edit/add pages to http://pyfaq.infogami.com/. The tutorial wiki
 has the edit, but the pyfaq page doesn't. I am logged in using my reddit
 login.

I don't think the FAQ is open to public editing yet.  I'm not sure
when it will be, but Fredrik might be able to give a timescale.

I've made a start on adding your questions, but probably won't get to
do much more until tomorrow.

Ed

On 21/04/06, Mike Hansen [EMAIL PROTECTED] wrote:


   Maybe this could be integrated with the main Python FAQ in a
   beginner's section? Fredrik Lundh is experimenting with a
  FAQ wiki here:
   http://pyfaq.infogami.com/
 
  Actually I put something about this on PyFAQ just the other day.
  Fredrik was quite keen on the idea, but I've been busy the
  last couple of days and haven't got around to doing anything about it.
 
  Mike, if you're volunteering that would be perfect.  If
  anyone here has ideas for questions that get asked a lot
  (like How do I write a program that prints a word
  backwards) then just posting them in this thread would be a
  good start.
 
  I assume Kent, Alan and Danny don't mind their answers being
  reused in the wiki, but it would probably best to get
  explicit permission from them (and other people) to re-use
  text from their answers.
 
  Ed
  ___
  Tutor maillist  -  Tutor@python.org
  http://mail.python.org/mailman/listinfo/tutor
 

 Yep, I'm volunteering. Forgive my ignorance, but I couldn't seem to figure
 out how to edit/add pages to http://pyfaq.infogami.com/. The tutorial wiki
 has the edit, but the pyfaq page doesn't. I am logged in using my reddit
 login.

 Below is what little I slapped together last night. I copied the content
 from the Python tutor mailman page for the first question.

 =
 Python Tutor FAQ
 -
 What is Python Tutor?

 This list is for folks who want to ask questions regarding how to learn
 computer programming with the Python language.

 Python (http://www.python.org) is a programming language which many feel is
 a good first language, because it makes it easy to express the fundamental
 concepts of programming such as data structures and algorithms with a syntax
 which many find easy to read and write.

 Folks interested in learning about programming with Python are encouraged to
 join, as are folks interested in helping others learn. While the list is
 called tutor, anyone, whether novice or expert, can answer questions.

 If individuals wish to start off-line conversations about a particular
 concept and become one-on-one tutor/tutee, that's fine. If either party
 wants to summarize what they learned for others to benefit, that's fine too.

 There is a searchable interface to archived Tutor messages on Activestate's
 web site at
 http://aspn.activestate.com/ASPN/Mail/Browse/Threaded/python-Tutor.

 To see the collection of prior postings to the list, visit the Tutor
 Archives at http://mail.python.org/pipermail/tutor/

 Using Tutor
 To post a message to all the list members, send email to tutor@python.org

 -
 I need help; I'm getting an error in my program. What should I do?

 If you are getting an error in your Python program that you don't
 understand, post the error message and any relevant code. Post the exact
 error message. Don't paraphrase the error message. The error message has
 details that can help resolve the issue that caused the error.

 -
 What is the policy on homework?

 Although those on the Python tutor mail list are eager to help, they don't
 want to hand you the answers to your homework. They want to help you find
 the answers. If you are having difficulty with your homework, send a message
 to the list about the problem and what you have tried. The tutors will try
 to nudge you in the right direction.

 -
 Why do my replies go to the person who sent the message and not to the list?

 This is by design.
 See http://www.unicom.com/pw/reply-to-harmful.html

 Also see this explanation
 http://mail.python.org/pipermail/tutor/2005-July/039889.html

 =

 Unless anyone has any more, I think the above covers the FAQs about the
 tutor list.

 Here's some of the FAQs that I came across scanning the list:

 ord and chr
 parsing html beautifulsoup
 editors/ides
 getters and setters
 regex match and find
 maxtrix operations
 how do I make an exe out of a python script
 books
 what should I program?
 unicode/encoding

 Mike


___
Tutor maillist  -  Tutor@python.org

Re: [Tutor] Tutor FAQ?

2006-04-21 Thread Ed Singleton
On 20/04/06, Kent Johnson [EMAIL PROTECTED] wrote:
 Mike Hansen wrote:
  I'd like to send a big Thank You to Danny, Alan, Kent and others(whos names
  escape me) for being such an asset to the Python community by relentlessly
  answering questions on the tutor list.(Do these guys sleep? They must work
  in shifts.) This list is one of the most civilized and responsive lists I
  have ever read. When many pop onto the list and ask what may seem like some
  of the most obvious questions, you guys calmly answer and nudge them in the
  right direction without ever losing your patience. It's a great list.

 Thanks! I do sleep but I have my email tied in to my clock radio so
 whenever an email arrives on the tutor list I am awakened to answer it ;)
 
  Anyway, I've been reading the list for a couple of years now, and I wonder
  if a Tutor FAQ would be helpful. I don't believe one exists. Should there be
  something on the Python wiki that would list the most common questions to
  the tutor list along with their answers? It would be a FAQ about the tutor
  list as well as common questions to the tutor list.

 I wonder about this sometimes too. I think it would be good to have a
 place to collect this stuff.

 Maybe this could be integrated with the main Python FAQ in a beginner's
 section? Fredrik Lundh is experimenting with a FAQ wiki here:
 http://pyfaq.infogami.com/

Actually I put something about this on PyFAQ just the other day. 
Fredrik was quite keen on the idea, but I've been busy the last couple
of days and haven't got around to doing anything about it.

Mike, if you're volunteering that would be perfect.  If anyone here
has ideas for questions that get asked a lot (like How do I write a
program that prints a word backwards) then just posting them in this
thread would be a good start.

I assume Kent, Alan and Danny don't mind their answers being reused in
the wiki, but it would probably best to get explicit permission from
them (and other people) to re-use text from their answers.

Ed
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Tutor FAQ?

2006-04-21 Thread Kent Johnson
Ed Singleton wrote:
 If anyone here
 has ideas for questions that get asked a lot (like How do I write a
 program that prints a word backwards) then just posting them in this
 thread would be a good start.

We should be careful about posting solutions to homework problems, which 
this could easily be.
 
 I assume Kent, Alan and Danny don't mind their answers being reused in
 the wiki, but it would probably best to get explicit permission from
 them (and other people) to re-use text from their answers.

Fine with me!

Kent

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Tutor FAQ?

2006-04-21 Thread Alan Gauld
I hereby give my permission for any answer I've ever posted to 
this list or to any other Python list or newsgroup to be used in 
any Python related FAQ anyone cares to produce! :-)

Alan G.

- Original Message - 
From: Ed Singleton [EMAIL PROTECTED]
To: tutor@python.org
Sent: Friday, April 21, 2006 2:38 PM
Subject: Re: [Tutor] Tutor FAQ?


 --
Mike, if you're volunteering that would be perfect.  If anyone here
has ideas for questions that get asked a lot (like How do I write a
program that prints a word backwards) then just posting them in this
thread would be a good start.

I assume Kent, Alan and Danny don't mind their answers being reused in
the wiki, but it would probably best to get explicit permission from
them (and other people) to re-use text from their answers.

Ed


___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Tutor FAQ?

2006-04-21 Thread Ed Singleton
On 21/04/06, Kent Johnson [EMAIL PROTECTED] wrote:
 Ed Singleton wrote:
  If anyone here
  has ideas for questions that get asked a lot (like How do I write a
  program that prints a word backwards) then just posting them in this
  thread would be a good start.

 We should be careful about posting solutions to homework problems, which
 this could easily be.

Agreed ;-)

The last couple of times people have asked this, there's been some
really good replies that helped them tease out the solution (what to
think about, how to think about the problem, etc).

I think quite a lot of the answers to some FAQs won't be solutions, but advice.

Ed
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Tutor FAQ?

2006-04-21 Thread Danny Yoo
 I assume Kent, Alan and Danny don't mind their answers being reused in 
 the wiki, but it would probably best to get explicit permission from 
 them (and other people) to re-use text from their answers.

I give explicit permission for any of my replies to be reused this way.
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Tutor FAQ?

2006-04-21 Thread Mike Hansen
 

  Maybe this could be integrated with the main Python FAQ in a 
  beginner's section? Fredrik Lundh is experimenting with a 
 FAQ wiki here:
  http://pyfaq.infogami.com/
 
 Actually I put something about this on PyFAQ just the other day. 
 Fredrik was quite keen on the idea, but I've been busy the 
 last couple of days and haven't got around to doing anything about it.
 
 Mike, if you're volunteering that would be perfect.  If 
 anyone here has ideas for questions that get asked a lot 
 (like How do I write a program that prints a word 
 backwards) then just posting them in this thread would be a 
 good start.
 
 I assume Kent, Alan and Danny don't mind their answers being 
 reused in the wiki, but it would probably best to get 
 explicit permission from them (and other people) to re-use 
 text from their answers.
 
 Ed
 ___
 Tutor maillist  -  Tutor@python.org
 http://mail.python.org/mailman/listinfo/tutor


Yep, I'm volunteering. Forgive my ignorance, but I couldn't seem to figure
out how to edit/add pages to http://pyfaq.infogami.com/. The tutorial wiki
has the edit, but the pyfaq page doesn't. I am logged in using my reddit
login. 

Below is what little I slapped together last night. I copied the content
from the Python tutor mailman page for the first question. 

=
Python Tutor FAQ
-
What is Python Tutor?

This list is for folks who want to ask questions regarding how to learn
computer programming with the Python language.

Python (http://www.python.org) is a programming language which many feel is
a good first language, because it makes it easy to express the fundamental
concepts of programming such as data structures and algorithms with a syntax
which many find easy to read and write.

Folks interested in learning about programming with Python are encouraged to
join, as are folks interested in helping others learn. While the list is
called tutor, anyone, whether novice or expert, can answer questions.

If individuals wish to start off-line conversations about a particular
concept and become one-on-one tutor/tutee, that's fine. If either party
wants to summarize what they learned for others to benefit, that's fine too.

There is a searchable interface to archived Tutor messages on Activestate's
web site at
http://aspn.activestate.com/ASPN/Mail/Browse/Threaded/python-Tutor.

To see the collection of prior postings to the list, visit the Tutor
Archives at http://mail.python.org/pipermail/tutor/

Using Tutor
To post a message to all the list members, send email to tutor@python.org

-
I need help; I'm getting an error in my program. What should I do?

If you are getting an error in your Python program that you don't
understand, post the error message and any relevant code. Post the exact
error message. Don't paraphrase the error message. The error message has
details that can help resolve the issue that caused the error.

-
What is the policy on homework?

Although those on the Python tutor mail list are eager to help, they don't
want to hand you the answers to your homework. They want to help you find
the answers. If you are having difficulty with your homework, send a message
to the list about the problem and what you have tried. The tutors will try
to nudge you in the right direction.

-
Why do my replies go to the person who sent the message and not to the list?

This is by design. 
See http://www.unicom.com/pw/reply-to-harmful.html

Also see this explanation
http://mail.python.org/pipermail/tutor/2005-July/039889.html

=

Unless anyone has any more, I think the above covers the FAQs about the
tutor list.

Here's some of the FAQs that I came across scanning the list:

ord and chr
parsing html beautifulsoup
editors/ides
getters and setters
regex match and find
maxtrix operations
how do I make an exe out of a python script 
books 
what should I program?
unicode/encoding 

Mike

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Tutor FAQ?

2006-04-21 Thread Kent Johnson
Mike Hansen wrote:

 -
 I need help; I'm getting an error in my program. What should I do?
 
 If you are getting an error in your Python program that you don't
 understand, post the error message and any relevant code. Post the exact
 error message. Don't paraphrase the error message. The error message has
 details that can help resolve the issue that caused the error.

Instead of Post the exact error message. I would say Copy and paste 
the entire error message into your email, including the traceback.

Kent

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Tutor FAQ?

2006-04-21 Thread Alan Gauld
I suspect the best way to generate a scientific list of FAQ is 
by scanning the subjects in the list archives. But here are 
a few more:

Special function _xxx_ doesn't work - double underscore needed

Lack of indentation or inconsistent indents - inc tabs and spaces

How to name an object based on user input - use a dictionary usually!

How to get an attribute of an object by name - getattr()

How does Python do my favourite PHP/Perl/VB trick
Various possibilities here

Binding functions to widgets
ie not using parens after the function name

How do I read the output from a program called via os.system()
popen, command and the new Popen class

Changing elements in a mutable object changes the object for 
all references

assignment versus equality in x=x+1

That should keep you busy :-)

Alan G.


 Below is what little I slapped together last night. I copied the content
 from the Python tutor mailman page for the first question. 
 

 Here's some of the FAQs that I came across scanning the list:
 
 ord and chr
 parsing html beautifulsoup
 editors/ides
 getters and setters
 regex match and find
 maxtrix operations
 how do I make an exe out of a python script 
 books 
 what should I program?
 unicode/encoding 
 
 Mike
 
 

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Tutor FAQ?

2006-04-21 Thread Mike Hansen
 -
  I need help; I'm getting an error in my program. What should I do?
  
  If you are getting an error in your Python program that you don't 
  understand, post the error message and any relevant code. Post the 
  exact error message. Don't paraphrase the error message. The error 
  message has details that can help resolve the issue that 
 caused the error.
 
 Instead of Post the exact error message. I would say Copy 
 and paste the entire error message into your email, including 
 the traceback.
 
 Kent
 

That's good. It didn't occur to me since I considered the error message as
including the traceback.

-
I need help; I'm getting an error in my program. What should I do?

If you are getting an error in your Python program that you don't
understand, post the error message and any relevant code. Copy and paste the
entire error message into your email, including the traceback. Don't
paraphrase the error message. The error message has details that can help
resolve the issue that caused the error.

Mike

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Tutor FAQ?

2006-04-20 Thread Mike Hansen
I'd like to send a big Thank You to Danny, Alan, Kent and others(whos names
escape me) for being such an asset to the Python community by relentlessly
answering questions on the tutor list.(Do these guys sleep? They must work
in shifts.) This list is one of the most civilized and responsive lists I
have ever read. When many pop onto the list and ask what may seem like some
of the most obvious questions, you guys calmly answer and nudge them in the
right direction without ever losing your patience. It's a great list.

Anyway, I've been reading the list for a couple of years now, and I wonder
if a Tutor FAQ would be helpful. I don't believe one exists. Should there be
something on the Python wiki that would list the most common questions to
the tutor list along with their answers? It would be a FAQ about the tutor
list as well as common questions to the tutor list.

FAQ about the Tutor List would include
- The policy on answering homework assignment
- Why the reply-to is set that way.
- Post code and exact error message.
(A lot of this might be in that initial message you get from mailman when
joining the list, but it might be a good idea to put it on the wiki)

FAQ for common questions to the list would include
- ord() and chr()
- Common GUI programming questions
- String module is deprecated, use string methods
- ???

I'm sure you can come up with more of the common questions. Does this sound
like a reasonable idea?

Mike

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Tutor FAQ?

2006-04-20 Thread Kent Johnson
Mike Hansen wrote:
 I'd like to send a big Thank You to Danny, Alan, Kent and others(whos names
 escape me) for being such an asset to the Python community by relentlessly
 answering questions on the tutor list.(Do these guys sleep? They must work
 in shifts.) This list is one of the most civilized and responsive lists I
 have ever read. When many pop onto the list and ask what may seem like some
 of the most obvious questions, you guys calmly answer and nudge them in the
 right direction without ever losing your patience. It's a great list.

Thanks! I do sleep but I have my email tied in to my clock radio so 
whenever an email arrives on the tutor list I am awakened to answer it ;)
 
 Anyway, I've been reading the list for a couple of years now, and I wonder
 if a Tutor FAQ would be helpful. I don't believe one exists. Should there be
 something on the Python wiki that would list the most common questions to
 the tutor list along with their answers? It would be a FAQ about the tutor
 list as well as common questions to the tutor list.

I wonder about this sometimes too. I think it would be good to have a 
place to collect this stuff.

Maybe this could be integrated with the main Python FAQ in a beginner's 
section? Fredrik Lundh is experimenting with a FAQ wiki here:
http://pyfaq.infogami.com/

 
 FAQ about the Tutor List would include
 - The policy on answering homework assignment
 - Why the reply-to is set that way.
 - Post code and exact error message.
 (A lot of this might be in that initial message you get from mailman when
 joining the list, but it might be a good idea to put it on the wiki)
 
 FAQ for common questions to the list would include
 - ord() and chr()
 - Common GUI programming questions
 - String module is deprecated, use string methods
 - ???
 
 I'm sure you can come up with more of the common questions. Does this sound
 like a reasonable idea?

Sounds good to me. Are you volunteering?

Kent

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Tutor FAQ?

2006-04-20 Thread Eric Walker

Kent Johnson wrote:

Mike Hansen wrote:
  

I'd like to send a big Thank You to Danny, Alan, Kent and others(whos names
escape me) for being such an asset to the Python community by relentlessly
answering questions on the tutor list.(Do these guys sleep? They must work
in shifts.) This list is one of the most civilized and responsive lists I
have ever read. When many pop onto the list and ask what may seem like some
of the most obvious questions, you guys calmly answer and nudge them in the
right direction without ever losing your patience. It's a great list.



Thanks! I do sleep but I have my email tied in to my clock radio so 
whenever an email arrives on the tutor list I am awakened to answer it ;)
  

Anyway, I've been reading the list for a couple of years now, and I wonder
if a Tutor FAQ would be helpful. I don't believe one exists. Should there be
something on the Python wiki that would list the most common questions to
the tutor list along with their answers? It would be a FAQ about the tutor
list as well as common questions to the tutor list.



I wonder about this sometimes too. I think it would be good to have a 
place to collect this stuff.


Maybe this could be integrated with the main Python FAQ in a beginner's 
section? Fredrik Lundh is experimenting with a FAQ wiki here:

http://pyfaq.infogami.com/

  

FAQ about the Tutor List would include
- The policy on answering homework assignment
- Why the reply-to is set that way.
- Post code and exact error message.
(A lot of this might be in that initial message you get from mailman when
joining the list, but it might be a good idea to put it on the wiki)

FAQ for common questions to the list would include
- ord() and chr()
- Common GUI programming questions
- String module is deprecated, use string methods
- ???

I'm sure you can come up with more of the common questions. Does this sound
like a reasonable idea?



Sounds good to me. Are you volunteering?

Kent

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

  
Hey guys the FAQ thing sound great. I found what I think is the best 
pyQT tutorial around.

Took me like 10 minutes and I am off and running.
http://www.cs.usfca.edu/~afedosov/qttut/

begin:vcard
fn:Eric Walker
n:Walker;Eric
org:Micron Technologies
email;internet:[EMAIL PROTECTED]
title:EDA Applications Engineer
tel;work:208-368-2573
version:2.1
end:vcard

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Tutor FAQ?

2006-04-20 Thread Alan Gauld

 I'd like to send a big Thank You to Danny, Alan, Kent and others

Over the years there have been many, some have moved from
tutor list to c.l.python others have just got too busy. Others reappear
and then disappear again at intervals. (Who remembers Ivan, Gregor,
Magnus etc etc.)

 answering questions on the tutor list.(Do these guys sleep? They must work
 in shifts.)

I live in the UK, Kent and Danny in the US so that gives
a 5-7 hour time shift for free! :-)

 if a Tutor FAQ would be helpful. I don't believe one exists.

It's been discussed several times but no-one ever quite got round to it.

If you want to make a worthwhile contribution to the Python
community that would be a good starting point!

My tutor tries to answer the most common questions but its
not so easy to findthe answers when buried inside a prose topic
page.

 the tutor list along with their answers? It would be a FAQ about the tutor
 list as well as common questions to the tutor list.

Agreed.

 FAQ about the Tutor List would include
 FAQ for common questions to the list would include

 I'm sure you can come up with more of the common questions.

And then all it takes is someone to collate them and provide the
answers. The Active State searchable artchive should be a
good starting point.

 like a reasonable idea?

Absolutely, are you volunteering? :-)

Alan G.

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Tutor FAQ?

2006-04-20 Thread Mike Hansen
 
 Thanks! I do sleep but I have my email tied in to my clock 
 radio so whenever an email arrives on the tutor list I am 
 awakened to answer it ;)

Hmmm.. I wouldn't be surprised if there's an X10 module that does that. =)

[...]

 Maybe this could be integrated with the main Python FAQ in a 
 beginner's section? Fredrik Lundh is experimenting with a FAQ 
 wiki here:
 http://pyfaq.infogami.com/

I'll take a look at this.

 Sounds good to me. Are you volunteering?

Yes, I'll get the ball rolling. I'll most likely do something on the site
above. I'll post to this list when I have something worth looking at.

Mike

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor