[Tutor] encoding text in html

2006-09-13 Thread anil maran

i was trying to display some text
it is in utf-8 in postgres and when it is displayed in firefox and ie,
it gets displayed as some symols with 4numbers in a box or so
even for ' apostrophe
please tell me how to display this properly
i try 
title.__str__

or title.__repr__
both dont work___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Traversing Excel Columns

2006-09-13 Thread Chris Hengge
I'll give that a shot tomorrow when I work on the script some more. 

Thanks for the note on 'file'... none of the IDE's I've used have
colored or yelled at me, so I just assumed it was free for the taking..
(used to VS where it yells at you for more then I'd care)

I've just started using SPE though... I'm very impressed with it
compared to some of the others of tried which either just weren't quite
ready for retail or to much like a plain text editor for my liking.
Unless something comes up that I can't get working right, I'll be
pitching the author a few bucks for his work :]

Thanks again for all the help. Hopefully one day I'll be able to
contribute some back!

On Wed, 2006-09-13 at 04:12 +0100, Alan Gauld wrote:
> > I can get file.write("'%s',") % xlSht.Cells(row,1).Value 
> > to work..
> 
> file.write("'%s'," % xlSht.Cells(row,1).Value)
> 
> Try that
> 
> The string formatting must happen inside the parens.
> 
> 
> BTW using 'file' as a variab;e is not good since file is a 
> built-in function name (albeit an alias for open) and could 
> confuse a reader..
> 
> 
> Alan G.
> 

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


Re: [Tutor] encoding text in html

2006-09-13 Thread anil maran
submits: We\xe2\x80\x99re pretty surthis is how it is stored in postgresplease help me outthanks- Original Message From: anil maran <[EMAIL PROTECTED]>To: tutor@python.orgSent: Wednesday, September 13, 2006 12:14:10 AMSubject: encoding text in html
i was trying to display some text
it is in utf-8 in postgres and when it is displayed in firefox and ie,
it gets displayed as some symols with 4numbers in a box or so
even for ' apostrophe
please tell me how to display this properly
i try 
title.__str__

or title.__repr__
both dont work___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] encoding text in html

2006-09-13 Thread anil maran

		  
	


「ひぐらしのなく頃に」30秒TVCF風ver.0.1 this is how it is getting displayed in browser- Original Message From: anil maran <[EMAIL PROTECTED]>To: anil maran <[EMAIL PROTECTED]>Sent: Wednesday, September 13, 2006 2:07:55 AMSubject: Re: [Tutor] encoding text in htmlsubmits: We\xe2\x80\x99re pretty surthis is how it is stored in postgresplease help me outthanks- Original Message From: anil maran <[EMAIL PROTECTED]>To: tutor@python.orgSent: Wednesday,
 September 13, 2006 12:14:10 AMSubject: [Tutor] encoding text in html
i was trying to display some text
it is in utf-8 in postgres and when it is displayed in firefox and ie,
it gets displayed as some symols with 4numbers in a box or so
even for ' apostrophe
please tell me how to display this properly
i try 
title.__str__

or title.__repr__
both dont work___Tutor maillist  -  Tutor@python.orghttp://mail.python.org/mailman/listinfo/tutor___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] encoding text in html

2006-09-13 Thread Kent Johnson
anil maran wrote:
> 
> 「ひぐらしのなく頃に」30秒TVCF風ver.0.1 
> 
> this is how it is getting displayed in browser

I'm pretty sure that is not how
We\xe2\x80\x99re
displays; can you show an example of the same text as it is stored and 
as it displays?

Kent

> 
> - Original Message 
> From: anil maran <[EMAIL PROTECTED]>
> To: anil maran <[EMAIL PROTECTED]>
> Sent: Wednesday, September 13, 2006 2:07:55 AM
> Subject: Re: [Tutor] encoding text in html
> 
> 
> 
> submits: We\xe2\x80\x99re pretty sur
> this is how it is stored in postgres
> please help me out
> thanks
> 
> 
> 
> - Original Message 
> From: anil maran <[EMAIL PROTECTED]>
> To: tutor@python.org
> Sent: Wednesday, September 13, 2006 12:14:10 AM
> Subject: [Tutor] encoding text in html
> 
> 
> i was trying to display some text
> it is in utf-8 in postgres and when it is displayed in firefox and ie, 
> it gets displayed as some symols with 4numbers in a box or so
> even for ' apostrophe
> please tell me how to display this properly
> i try
> title.__str__
> 
> or title.__repr__
> both dont work
> ___
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
> 
> 
> 
> 
> 
> ___
> 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] encoding text in html

2006-09-13 Thread Kent Johnson
anil maran wrote:
> 
> 
> i was trying to display some text
> it is in utf-8 in postgres and when it is displayed in firefox and ie, 
> it gets displayed as some symols with 4numbers in a box or so
> even for ' apostrophe
> please tell me how to display this properly
> i try
> title.__str__
> 
> or title.__repr__
> both dont work

Do you have the page encoding set to utf-8 in Firefox? You can do this
with View / Character Encoding as a test. If it displays correctly when
you set the encoding then you should include a meta tag in the HTML that
sets the charset. Put this in the  of the HTML:
   

Kent


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


[Tutor] about assert

2006-09-13 Thread linda.s
Python manual has a very brief introduction of "assert" statements. It
is very difficult for me to understand it. Can anyone give me an
example?
Thanks,
Linda
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] about assert

2006-09-13 Thread Luke Paireepinart
linda.s wrote:
> Python manual has a very brief introduction of "assert" statements. It
> is very difficult for me to understand it. Can anyone give me an
> example?
>   
#example of assert.py
def test(a):
if 25 / 4 == a:
return True
else:
return False

def assert_it(a):
try:
assert a
print "Success!"
except AssertionError:
print "something went wrong!"
f = test(4)
assert_it(f)
f = test(6)
assert_it(f)

#--- end code

It seems to me that you don't really need to know what assert is,
because the value of __debug__ will probably be true,
and so you might as well write if not a: raise AssertionError
instead, except I guess assert is shorter.
But then if you use assert assuming __debug__ will be true,
then if it's not bad things will happen.
I'm sure someone can give you a better explanation of this,
but I have to get to class.
HTH,
-Luke
> Thanks,
> Linda
> ___
> 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] about assert

2006-09-13 Thread Marc Poulin

--- "linda.s" <[EMAIL PROTECTED]> wrote:

> Python manual has a very brief introduction of
> "assert" statements. It
> is very difficult for me to understand it.


Every program has some fundamental assumptions that
must remain true in order for the program to continue
giving correct results.

The assert statement is used to verify those
assumptions. (The optional 2nd parameter can be used
to give additional information about what went wrong.)

For example, in my world no one is allowed to have a
negative age. A negative age means my program is
hopelessly confused and should halt immediately.

>>> myAge=42
>>> assert myAge>=0  ## this is OK

>>> myAge= -1## logically impossible
>>> assert myAge >= 0
Traceback (most recent call last):
  File "", line 1, in ?
AssertionError

## here I print the condition that failed
>>> assert myAge >=0, 'myAge >= 0'
Traceback (most recent call last):
  File "", line 1, in ?
AssertionError: myAge >= 0


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] quick ?

2006-09-13 Thread dpotter
I am new to Python (and programming).  In teaching myself I wrote a
small program that will pick random lottery numbers, I want to check for
duplicates and rerun the random function.  But I am hitting a wall. 
This is what I think should work, but I still get duplicates.  TIA.



print "\n"
count = input("How many quick picks do you need? ")
print "\n"
num = 0
while count > 0:
   num1 = randint(1,55)
   num2 = randint(1,55)
   while  num2 == num1:
# looking for duplicates
  num2 = randint(1,55)
   num3 = randint(1,55)
   while num3 == (num1 or num2):   
# looking for duplicates
 num3 = randint(1,55)
   num4 = randint(1,55)
   while num4 == (num1 or num2 or num3):   
# looking for duplicates
 num4 = randint(1,55)
   num5 = randint(1,55)
   while num5 == (num1 or num2 or num3 or num4):   
# looking for duplicates
 num5 = randint(1,55)
   pb = randint(1,42)
   count = count - 1
   answer = [num1, num2, num3, num4, num5]
   answer.sort()
   num = num + 1
   print "#",num, answer, "and for the powerball:", pb
print "\n"

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


Re: [Tutor] quick ?

2006-09-13 Thread Kent Johnson
[EMAIL PROTECTED] wrote:
> I am new to Python (and programming).  In teaching myself I wrote a
> small program that will pick random lottery numbers, I want to check for
> duplicates and rerun the random function.  But I am hitting a wall. 
> This is what I think should work, but I still get duplicates.  TIA.
> 
> 
> 
> print "\n"
> count = input("How many quick picks do you need? ")
> print "\n"
> num = 0
> while count > 0:
>num1 = randint(1,55)
>num2 = randint(1,55)
>while  num2 == num1:
> # looking for duplicates
>   num2 = randint(1,55)
>num3 = randint(1,55)
>while num3 == (num1 or num2):  

This doesn't do what you want; (num1 or num2) is evaluated first; the 
value of this expression will be num1, since num1 is not 0. Then you 
compare num3 to the result.

You need
   while num3 == num1 or num3 == num2:

or, a version that scales better:
   while num3 in [ num1, num2 ]

or even better, take a look at random.sample()

Kent

> # looking for duplicates
>  num3 = randint(1,55)
>num4 = randint(1,55)
>while num4 == (num1 or num2 or num3):   
> # looking for duplicates
>  num4 = randint(1,55)
>num5 = randint(1,55)
>while num5 == (num1 or num2 or num3 or num4):   
> # looking for duplicates
>  num5 = randint(1,55)
>pb = randint(1,42)
>count = count - 1
>answer = [num1, num2, num3, num4, num5]
>answer.sort()
>num = num + 1
>print "#",num, answer, "and for the powerball:", pb
> print "\n"
> 
> ___
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
> 
> 


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


[Tutor] CGI / HTTP

2006-09-13 Thread Rob



I created a CGI form mailer script that would keep 
individual email addresses private.
 
The emailer works fine and I have created similar 
scripts that work.  However, I wanted to forward the info from a form 
without having the script return any content.  So if there are no errors, 
the visitor would only get a _javascript_ alert thanking them for contacting us, 
no page change is made.
 
I've tried a couple of things and either get a 500 
error or the browser tries to download the CGI script.  I have a feeling 
that it has to do with HTTP headers.  Except for content-type:, I don't 
know how to properly use HTTP headers from within a python CGI 
script.
 
Is there a way to submit form data to a CGI script 
and not have anything returned?
 
Thanks,
 
-- Rob
 
 
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] encoding text in html

2006-09-13 Thread Danny Yoo


On Wed, 13 Sep 2006, anil maran wrote:

>
> i was trying to display some text it is in utf-8 in postgres and when it 
> is displayed in firefox and ie, it gets displayed as some symols with 
> 4numbers in a box or so even for ' apostrophe please tell me how to 
> display this properly i try title.__str__

I'm assuming that you're dynamically generating some HTML document.  If 
so, have you declared the "document encoding" in the HTML file to be 
utf-8?

See:

 http://www.joelonsoftware.com/articles/Unicode.html

Do you have a small sample of the HTML file that's being generated?  One 
of us here may want to inspect it to make sure you really are generating 
UTF-8 output.  You may also want to show the Python code you've written to 
generate the output.

Try to give us enough information so we can attempt to reproduce what 
you're seeing.

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


[Tutor] Excluding branches while walking directory tree

2006-09-13 Thread William O'Higgins Witteman
Hello all,

I am looking for an approach for the following problem:

I have to walk a directory tree and examine files within it.  I have a
set of directory names and filename patterns that I must skip while
doing this walk.  How do I create a set of rules to skip files or
directory branches?  I'm looking for something reasonably scalable, 
'cause I'm sure to need to update these rules in the future.

Thanks.
-- 

yours,

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


Re: [Tutor] quick ?

2006-09-13 Thread Bob Gailer
[EMAIL PROTECTED] wrote:
> I am new to Python (and programming).  In teaching myself I wrote a
> small program that will pick random lottery numbers, I want to check for
> duplicates and rerun the random function.  But I am hitting a wall. 
> This is what I think should work, but I still get duplicates.  TIA.
random.shuffle() is the predefined way to do this. But for more general 
things like this it is better to use a list to hold multiple values.

Example:

import random
picks = [] # collect unique picks
count = input("How many quick picks do you need? ")
while len(picks) < count:
  pick = random.randint(1,55)
  if not pick in picks: 
picks.append(pick)
print picks

OR

import random
picks = [0]*55
count = input("How many quick picks do you need? ")
got = 0
while got < count:
  pick = random.randint(1,55)
  if not picks[pick]: 
picks[pick] = 1
got += 1
for i in range(len(picks)+1):
  if picks[i]:
print i, 


-- 
Bob Gailer
510-978-4454

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


Re: [Tutor] Excluding branches while walking directory tree

2006-09-13 Thread Kent Johnson
William O'Higgins Witteman wrote:
> Hello all,
> 
> I am looking for an approach for the following problem:
> 
> I have to walk a directory tree and examine files within it.  I have a
> set of directory names and filename patterns that I must skip while
> doing this walk.  How do I create a set of rules to skip files or
> directory branches?  I'm looking for something reasonably scalable, 
> 'cause I'm sure to need to update these rules in the future.

os.walk() lets you prune the directory list to avoid processing specific 
directories.

fnmatch.fnmatch() does simple wildcard pattern matching. So maybe 
something like this (*not* tested):

import os, fnmatch

def matchesAny(name, tests):
   for test in tests:
 if fnmatch.fnmatch(name, test):
   return True
   return False

dirsToSkip = [ ... ] # list of directory patterns to skip
filesToSkip = [ ... ] # list of file patterns to skip

for dirpath, dirnames, filenames in os.walk(baseDir):
   # Note use of slice assignment - you have to modify the caller's list
   dirnames[:] = [ name for name in dirnames if not matchesAny(name, 
dirsToSkip) ]

   filenames = [name for name in filenames if not matchesAny(name, 
filesToSkip) ]

   for name in filenames:
 # whatever file processing you want to do goes here


You could get the list of patterns from another file that you import, or 
a config file, or command line args, depending on how you want to store 
them and change them.

For more flexibility in the patterns you could use a regular expression 
match instead of fnmatch(). You also might want to match on full paths 
rather than just the file or dir name.

HTH,
Kent

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


[Tutor] Using my own installed python version in my directory tree.

2006-09-13 Thread Ziad Rahhal
Hi,

I installed pythin on Linux operating system but on my own tree directory. Now I want to get rid (not deleting)
the default python installation, which means I want my own python version to be recognized when I use "python" command.

PYTHONPATH has nothing to do with that since it just points to modules. I tried to set the PATH to $HOME/python/bin but this 
didn't work.

So in bried I want to use my own installed python version in my
directory without the need to type $HOME/python/bin... and I want
to use my own installed python libraries and modules, ignoring the default installation.

How that could be done?

Thank you in advance,

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


Re: [Tutor] Excluding branches while walking directory tree

2006-09-13 Thread Dave Kuhlman
On Wed, Sep 13, 2006 at 11:15:44AM -0400, William O'Higgins Witteman wrote:
> Hello all,
> 
> I am looking for an approach for the following problem:
> 
> I have to walk a directory tree and examine files within it.  I have a
> set of directory names and filename patterns that I must skip while
> doing this walk.  How do I create a set of rules to skip files or
> directory branches?  I'm looking for something reasonably scalable, 
> 'cause I'm sure to need to update these rules in the future.
> 

For the first part of your problem, take a look at os.walk():
http://docs.python.org/lib/os-file-dir.html
And also glob.glob():
http://docs.python.org/lib/module-glob.html

The "in" operator is likely to be helpful in determining which
files to skip.  Suppose that you have a list of file names to be
ignored:

skips = ['ignore1.txt', 'ignore2.txt']

then check a filename against the names to be skipped:

if filename not in skips:
# process the files not to be ignored here.

And, for more complex cases, you may want to write a test function
that returns True or False depending on whether the file is to be
ignored.  A trivial example:

def good_file(filename, skips):
if filename in skips:
return False
else:
return True

skips = ['ignore1.txt', 'ignore2.txt']
if good_file(filename, skips):
# process good files here
o
o
o


Dave


-- 
Dave Kuhlman
http://www.rexx.com/~dkuhlman
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Using my own installed python version in my directory tree.

2006-09-13 Thread Dave Kuhlman
On Wed, Sep 13, 2006 at 05:39:13PM +0200, Ziad Rahhal wrote:
> Hi,
> 
> I installed pythin on Linux operating system but on my own tree directory.
> Now I want to get rid (not deleting)
> the default python installation, which means I want my own python version to
> be recognized when I use "python" command.
> 
> PYTHONPATH has nothing to do with that since it just points to modules. I
> tried to set the PATH to $HOME/python/bin but this
> didn't work.
> 
> So in bried I want to use my own installed python version in my directory
> without the need to type $HOME/python/bin... and I want
> to use my own installed python libraries and modules, ignoring the default
> installation.
> 
> How that could be done?

1. The first part of your problem (not typing $HOME/python/bin...
   each time could be solved in either of two ways:

   - Create an alias:

 alias python='$HOME/python/bin/...'

   - Create a symbolic link in a directory that is on your PATH
 *before* the directories containing other pythons:

 ln -s $HOME/python/bin...  python

2. With respect to importing up modules from the correct location,
   if you have installed Python correctly, using your python
   executable will also tell python where to look for modules. I
   also have two Pythons installed on my Linux machine (maybe more,
   I'm not sure).  One is under /usr and the other under
   /usr/local.  When I run /usr/bin/python, it uses the modules
   installed under /usr/lib/python2.4/site-packages/.  And, when I
   run /usr/local/bin/python, it uses modules installed under
   /usr/local/lib/python2.4/site-packages/.

   You can check this by doing something like:

   ~ [5] /usr/bin/python
   Python 2.4.3 (#2, Apr 27 2006, 14:43:58)
   [GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2
   Type "help", "copyright", "credits" or "license" for more information.
   >>>
   >>> import sys
   >>> sys.path

   which tells you where python looks for modules to be imported.

And, by the way, when you install a python package/module by using:

$ python setup.py install

python will install the package in the correct location depending
on which python executable you use to do the install.  So, the
following two lines install a module in two different places:

$ /usr/bin/python setup.py install

$ /usr/local/bin/python setup.py install

Dave

-- 
Dave Kuhlman
http://www.rexx.com/~dkuhlman
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] python for web developing

2006-09-13 Thread federico ramirez
Hello! I have heard that python is very good for web development, but you need frameworks, like django or turbogears.I know that you dont really need them, you can just write cgi scripts with python...butIm a php programmer, and i want to make another dinamic site with sql, in python, but i need sql object or other sql...
And i cant get a host with it, a free host just to test it.Any recomendations?-- Best Regards.fedekiller
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] CGI / HTTP

2006-09-13 Thread Kent Johnson
Rob wrote:
> 
> I created a CGI form mailer script that would keep individual email 
> addresses private.
>  
> The emailer works fine and I have created similar scripts that work.  
> However, I wanted to forward the info from a form without having the 
> script return any content.  So if there are no errors, the visitor would 
> only get a javascript alert thanking them for contacting us, no page 
> change is made.
>  
> I've tried a couple of things and either get a 500 error or the browser 
> tries to download the CGI script.  I have a feeling that it has to do 
> with HTTP headers.  Except for content-type:, I don't know how to 
> properly use HTTP headers from within a python CGI script.
>  
> Is there a way to submit form data to a CGI script and not have anything 
> returned?

This is not really a Python question...when you submit a form in the 
normal way, the browser expects the server to respond with a new page 
which the browser displays. So I don't think you can submit a form with 
a normal POST and keep the same page display.

You need to look at alternate methods to send the data to the server 
such as XmlHttpRequest (AJAX). Google "ajax form submit" for lots of 
suggestions.

Kent

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


[Tutor] what happens when...

2006-09-13 Thread josip
Hi all!  Can You explain me what happens when in this function I remove board arg:  def human_move(board, human)?  What is doing that argument?     Thanks!              # global constantsX = "X"O = "O"EMPTY = " "TIE = "TIE"NUM_SQUARES = 9  def display_instruct():    """Display game instructions."""      print \    """    Welcome to the greatest intellectual challenge of all time: Tic-Tac-Toe.      This will be a showdown between your human brain and my silicon processor.        You will make your move known by entering a number, 0 - 8.  The number     will correspond to the board position as illustrated:   
     0 | 1 | 2    -    3 | 4 | 5    -    6 | 7 | 8      Prepare yourself, human.  The ultimate battle is about to begin. \n    """  def ask_yes_no(question):    """Ask a yes or no question."""    response = None    while response not in ("y",
 "n"):    response = raw_input(question).lower()    return response  def ask_number(question, low, high, step=1):    """Ask for a number within a range."""    response = None    while response not in range(low, high, step):    response = int(raw_input(question))    return response  def pieces():    """Determine if player or computer goes first."""    go_first = ask_yes_no("Do you require the first move? (y/n): ")    if go_first == "y":    print "\nThen take the first move.  You will need it."    human = X    computer = O   
 else:    print "\nYour bravery will be your undoing... I will go first."    computer = X    human = O    return computer, human  def new_board():    """Create new game board."""    board = []    for square in range(NUM_SQUARES):    board.append(EMPTY)    return board  def display_board(board):    """Display game board on screen."""    print "\n\t", board[0], "|", board[1], "|", board[2]    print "\t", "-"    print "\t", board[3], "|", board[4], "|", board[5]    print "\t", "-"    print "\t", board[6], "|", board[7], "|", board[8], "\n" 
 def legal_moves(board):    """Create list of legal moves."""    moves = []    for square in range(NUM_SQUARES):    if board[square] == EMPTY:    moves.append(square)    return moves  def winner(board):    """Determine the game winner."""    WAYS_TO_WIN = ((0, 1, 2),   (3, 4, 5),   (6, 7, 8),   (0, 3,
 6),   (1, 4, 7),   (2, 5, 8),   (0, 4, 8),   (2, 4, 6))        for row in WAYS_TO_WIN:    if board[row[0]] == board[row[1]] == board[row[2]] != EMPTY:    winner = board[row[0]]    return winner      if EMPTY not in board:    return TIE 
     return None  def human_move(human):  # <= here is board removed    """Get human move."""      legal = legal_moves(board)    move = None    while move not in legal:    move = ask_number("Where will you move? (0 - 8):", 0, NUM_SQUARES)    if move not in legal:    print "\nThat square is already occupied, foolish human.  Choose another.\n"    print "Fine.."    return move  def computer_move(board, computer, human):    """Make computer move."""    # make a copy to work with since function will be changing list    board = board[:]    # the best positions to have, in
 order    BEST_MOVES = (4, 0, 2, 6, 8, 1, 3, 5, 7)       print "I shall take square number",        # if computer can win, take that move    for move in legal_moves(board):    board[move] = computer    if winner(board) == computer:    print move    return move    # done checking this move, undo it    board[move] = EMPTY        # if human can win, block that move    for move in legal_moves(board):    board[move] = human    if
 winner(board) == human:    print move    return move    # done checkin this move, undo it    board[move] = EMPTY      # since no one can win on next move, pick best open square    for move in BEST_MOVES:    if move in legal_moves(board):    print move    return move  def next_turn(turn):    """Switch turns."""    if turn == X:    return O    else:    return X 
     def congrat_winner(the_winner, computer, human):    """Congratulate the winner."""    if the_winner != TIE:    print the_winner, "won!\n"     else:    print "It's a tie!\n"      if the_winner == computer:    print "As I predicted, human, I am triumphant once more.  \n" \  "Proof that computers are superior to humans in all regards."      elif the_winner == human:    print "No, no!  It cannot be!  Somehow you tricked me, human. \n" \  "But never again!  I, the computer, so swears it!" 
     elif the_winner == TIE:    print "You were most lucky, human, and somehow managed to tie me.  \n" \  "Celebrate today... for this is the best you will ever achieve."  def main():    display_instruct()

Re: [Tutor] about assert

2006-09-13 Thread alan . gauld
>>Python manual has a very brief introduction 
>>of "assert" statements. It is very difficult 

First you probably don't need to use asserts 
very often, they are useful if you are building 
production strength code but for most users 
of Python the exception mechanism is good enough.

Basically we use asserts to check pre and post 
conditions as well as\ invariants in functions.
Anything other than that should be done using 
explicit if/else or exceptions. The reason for 
that is that asserts only operate when the code 
is in debug mode... so they should not be 
used for normal run time error detection.

Typical things to check are that input values 
are within expected ranges and of desired types.
Also that the final retrurn value of a function 
is within expected limits.
Once we finish testing the overhead of those 
checks might not be required in the final 
version if we are sure they will never 
deviate from the test results.

The syntax can be demonstrated quite easily 
and Luke has done that, the intent is a little 
less obvious and IMHO really needs a larger 
example to make the value obvious. Since I'm 
at a cyber-cafe net terminal I dont feel like 
trying that just now! :-)

HTH,

Alan G.

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


[Tutor] List manipulation

2006-09-13 Thread Srinivas Iyyer
Dear group:

I have a data like this:
10  15
16  20
25  35
45  50
55  60
61  65
75  80

Since 15 precedes 16, I want to consider 10:20 as one
unit.  If I repeat completely for data

I would get:
10  20
25  35
45  50
55  65
75  80

test = ['10\t15', '16\t20', '25\t35', '45\t50',
'55\t60', '61\t65', '75\t80']


I cannot think a way to do this in simple. Could
members suggest some way to solve this please. 

thanks




__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] GDAL- Help

2006-09-13 Thread Nagendra Singh
Hi,

I am just starting to learn Python and I want to perform some GIS
tasks which requires the gdal module (http://www.gdal.org/). I have
installed FWTools which also comes with a built in Python interface
but I also have a stand alone version of Python which I use. I am
trying to use the gdal module but I keep getting an error message that
gdal module is not found,even after appending the module using the
sys.path.append command. Can you anyone please let me know how do I
use the gdal module in the python I have (I dowlloaded it from
activestate) or I have to use the Python which comes with gdal but it
does not offer me the IDE.

thanks in advance
Nagendra
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] about assert

2006-09-13 Thread Marc Poulin

--- [EMAIL PROTECTED] wrote:

> >>Python manual has a very brief introduction 
> >>of "assert" statements. It is very difficult 
> 
> First you probably don't need to use asserts 
> very often, they are useful if you are building 
> production strength code but for most users 
> of Python the exception mechanism is good enough.
> 

This link makes some good points about how and when
to use assertions:
http://java.sun.com/j2se/1.4.2/docs/guide/lang/assert.html

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] List manipulation

2006-09-13 Thread Bob Gailer
Srinivas Iyyer wrote:
> Dear group:
>
> I have a data like this:
> 10  15
> 16  20
> 25  35
> 45  50
> 55  60
> 61  65
> 75  80
>
> Since 15 precedes 16, I want to consider 10:20 as one
> unit.  If I repeat completely for data
>
> I would get:
> 10  20
> 25  35
> 45  50
> 55  65
> 75  80
>
> test = ['10\t15', '16\t20', '25\t35', '45\t50',
> '55\t60', '61\t65', '75\t80']
>
>
> I cannot think a way to do this in simple. Could
> members suggest some way to solve this please. 
>   
I assume by "precedes" you mean is one-less-than. To test this you 
should convert the strings into integers. Since the numbers come in 
pairs each pair must be split at the \t (using split), then convert each 
number to integer (using int).

Hope that's enough to get you started.

-- 
Bob Gailer
510-978-4454

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


[Tutor] Methods and classes

2006-09-13 Thread Chris Hengge
Can anyone explain what I've been reading? I'm trying to understand why
many documents show:
def myMethod(vars): 
or
class myClass(var):
and others show:
def myMetheod(self, vars)
or
class myClass(self, vars)

Either way seems to work fine, so I'm not sure what it happening.

Also, what is with the double underscores? (__init__ for example) is
this required? or a Pythonic naming convention? When and how to use?

I'm 'trying' to write clear pythonic code since in all reality it gives
a nice polish to the code when compared to writing c style. 

Thanks. 

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


Re: [Tutor] List manipulation

2006-09-13 Thread Srinivas Iyyer
Thank you Bob for your email.
Sorry for the confusion. 
here is what I ment:

test = ['10\t15', '16\t20', '25\t35', '45\t50',
'55\t60', '61\t65', '75\t80']


>>> x = []
>>> y = []
>>> for m in test:
... cols = m.split('\t')
... x.append(cols[0])
... y.append(cols[1])
...

>>> x
['10', '16', '25', '45', '55', '61', '75']
>>> y
['15', '20', '35', '50', '60', '65', '80']

>>> for m in range(0,6):
... k = m+1
... if int(x[k])-int(y[m])==1:
... print x[m]+'\t'+y[k]
... else:
... print x[m]+'\t'+y[m]
...
10  20
16  20 # This is unwanted #
25  35
45  50
55  65
61  65# This is unwanted #
75  80 # IS MISSING from result###

16-20 and 61-65 is unwanted, to get rid of these I am
doing these.
My desired result:
10  20
25  35
45  50
55  65
75  80



If I consider the length of the list:
>>> for m in range(0,7):
... k = m+1
... if int(x[k])-int(y[m])==1:
... print x[m]+'\t'+y[k]
... else:
... print x[m]+'\t'+y[m]
...
10  20
16  20
25  35
45  50
55  65
61  65
Traceback (most recent call last):
  File "", line 3, in ?
IndexError: list index out of range




How can I avoid 16-20 and 61-65 and get 75-80 in the
result. 

Also, is there any easy way to do this. 

Thanks







--- Bob Gailer <[EMAIL PROTECTED]> wrote:

> Srinivas Iyyer wrote:
> > Dear group:
> >
> > I have a data like this:
> > 10  15
> > 16  20
> > 25  35
> > 45  50
> > 55  60
> > 61  65
> > 75  80
> >
> > Since 15 precedes 16, I want to consider 10:20 as
> one
> > unit.  If I repeat completely for data
> >
> > I would get:
> > 10  20
> > 25  35
> > 45  50
> > 55  65
> > 75  80
> >
> > test = ['10\t15', '16\t20', '25\t35', '45\t50',
> > '55\t60', '61\t65', '75\t80']
> >
> >
> > I cannot think a way to do this in simple. Could
> > members suggest some way to solve this please. 
> >   
> I assume by "precedes" you mean is one-less-than. To
> test this you 
> should convert the strings into integers. Since the
> numbers come in 
> pairs each pair must be split at the \t (using
> split), then convert each 
> number to integer (using int).
> 
> Hope that's enough to get you started.
> 
> -- 
> Bob Gailer
> 510-978-4454
> 
> 


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Methods and classes

2006-09-13 Thread John Fouhy
On 14/09/06, Chris Hengge <[EMAIL PROTECTED]> wrote:
> Can anyone explain what I've been reading? I'm trying to understand why
> many documents show:
>def myMethod(vars):
> or
>class myClass(var):
> and others show:
>def myMetheod(self, vars)
> or
>class myClass(self, vars)

Um.  Can you give an example of something saying "class myClass(self,
vars)" ?  The "arguments" to a class are other classes that you want
to inherit from, and are different from function arguments!

As to your other question, though ---

Suppose I have a class:

class MyClass(object):
# etc

And suppose I create an instance of that class:

mc = MyClass()

And then I call a method on that instance:

mc.someFunc(3, 'foo')

Although I have given the function someFunc two arguments, it will
actually be passed _three_ arguments.  The first argument will be mc
itself.  So, in the definition of MyClass, you would have:

def someFunc(self, x, s):
# etc

"self" is the name traditionally given to the first parameter, which
receives the class instance.  If you wanted to make things explicit,
you could instead do:

MyClass.someFunc(mc, 3, 'foo')

I think this is exactly equivalent to mc.someFunc(3, 'foo').  (someone confirm?)

On the other hand, if you're writing a utility function that's not
part of a class, you won't give it a "self" parameter.

Hope this helps :-)

> Also, what is with the double underscores? (__init__ for example) is
> this required? or a Pythonic naming convention? When and how to use?

Various special methods have the form "__xxx__".  For example, the
builtin function str converts things into strings.  str is associated
with the special method __str__.  If you write:

s = str(o)

this is equivalent to:

s = o.__str__()

and you can define / override the __str__ function in your own classes
to control how they are converted to strings.

Also, there is a convention that variable names starting with a single
underscore are private (since there's no "true" concept of
private/public in python).  Variable names starting with two
underscores are "more private", and python mangles the name a bit.

eg, try the following:

class Foo(object):
def __init__(self):
self.x = 1
self._y = 2
self.__z = 3

f = Foo()
print f.x
print f._y
print f.__z

> I'm 'trying' to write clear pythonic code since in all reality it gives
> a nice polish to the code when compared to writing c style.

I don't think you'll find many here who disagree with that :-)

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


Re: [Tutor] what happens when...

2006-09-13 Thread John Fouhy
On 14/09/06, josip <[EMAIL PROTECTED]> wrote:
>
> Hi all!
> Can You explain me what happens when in this function I remove board arg:
> def human_move(board, human)?
> What is doing that argument?

Have you tried removing the argument and running the code?  What error
message do you get?  What do you think it means?

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


Re: [Tutor] Methods and classes

2006-09-13 Thread Chris Hengge
OK, now that you asked for an example of a class using 'self', I can't
find it..so either the thing I was reading was wrong... or I dreamed it
up.. or it was something specific that I was looking at that decided I
wasn't interested in and now I don't remember. 

As for a quick example of the methods using (self, variables)..
the first example I've found of my list of resources is the deitel book
"Python - How to Program" Every method I've seen in this particular book
places 'self' as a parameter for each method. I am sure I've seen this
in at least one other book, as well as a few websites I've hit.

The deitel book has a note on page 229:
Failure to specify an object reference (usually called self) as the
first parameter in a method definition causes fatal logic errors when
the method is invoked at runt-ime.

Now I've got methods all over the place among several scripts that don't
use self, and each other works fine as I'd expect. 

Thanks for the other information!

On Thu, 2006-09-14 at 09:18 +1200, John Fouhy wrote:
> On 14/09/06, Chris Hengge <[EMAIL PROTECTED]> wrote:
> > Can anyone explain what I've been reading? I'm trying to understand why
> > many documents show:
> >def myMethod(vars):
> > or
> >class myClass(var):
> > and others show:
> >def myMetheod(self, vars)
> > or
> >class myClass(self, vars)
> 
> Um.  Can you give an example of something saying "class myClass(self,
> vars)" ?  The "arguments" to a class are other classes that you want
> to inherit from, and are different from function arguments!
> 
> As to your other question, though ---
> 
> Suppose I have a class:
> 
> class MyClass(object):
> # etc
> 
> And suppose I create an instance of that class:
> 
> mc = MyClass()
> 
> And then I call a method on that instance:
> 
> mc.someFunc(3, 'foo')
> 
> Although I have given the function someFunc two arguments, it will
> actually be passed _three_ arguments.  The first argument will be mc
> itself.  So, in the definition of MyClass, you would have:
> 
> def someFunc(self, x, s):
> # etc
> 
> "self" is the name traditionally given to the first parameter, which
> receives the class instance.  If you wanted to make things explicit,
> you could instead do:
> 
> MyClass.someFunc(mc, 3, 'foo')
> 
> I think this is exactly equivalent to mc.someFunc(3, 'foo').  (someone 
> confirm?)
> 
> On the other hand, if you're writing a utility function that's not
> part of a class, you won't give it a "self" parameter.
> 
> Hope this helps :-)
> 
> > Also, what is with the double underscores? (__init__ for example) is
> > this required? or a Pythonic naming convention? When and how to use?
> 
> Various special methods have the form "__xxx__".  For example, the
> builtin function str converts things into strings.  str is associated
> with the special method __str__.  If you write:
> 
> s = str(o)
> 
> this is equivalent to:
> 
> s = o.__str__()
> 
> and you can define / override the __str__ function in your own classes
> to control how they are converted to strings.
> 
> Also, there is a convention that variable names starting with a single
> underscore are private (since there's no "true" concept of
> private/public in python).  Variable names starting with two
> underscores are "more private", and python mangles the name a bit.
> 
> eg, try the following:
> 
> class Foo(object):
> def __init__(self):
> self.x = 1
> self._y = 2
> self.__z = 3
> 
> f = Foo()
> print f.x
> print f._y
> print f.__z
> 
> > I'm 'trying' to write clear pythonic code since in all reality it gives
> > a nice polish to the code when compared to writing c style.
> 
> I don't think you'll find many here who disagree with that :-)
> 

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


Re: [Tutor] Methods and classes

2006-09-13 Thread John Fouhy
On 14/09/06, Chris Hengge <[EMAIL PROTECTED]> wrote:
> The deitel book has a note on page 229:
>Failure to specify an object reference (usually called self) as the
> first parameter in a method definition causes fatal logic errors when
> the method is invoked at runt-ime.
>
> Now I've got methods all over the place among several scripts that don't
> use self, and each other works fine as I'd expect.

It depends whether you're writing class methods or not.

I could do this, for example:

def increment(x):
return x+1

and that would be fine, with no self parameter.  It's just a
standalone function.

OTOH, I might decide I want to write my own integer wrapper.

class MyInt(object):
def __init__(self, i):
self.value = i

I would create an instance of MyInt like so:

i = MyInt(3)

The parameter 3 gets passed to __init__ as 'i'.  If I left out 'self',
python would complain that __init__ only takes one argument and I've
given it two.

I could define a MyInt method like this:

def increment(self):
self.value = self.value + 1

thus:
>>> i.increment()
>>> i.increment()
>>> print i.value
5

How would you write increment() without a self parameter?  You need
some way of referring to the "value" attribute of the instance.  If
you just write "value = value + 1", python will think you are talking
about a local variable, and complain because it can't find one with
that name.  If you write:

def increment():
self.value = self.value + 1

then you're referring to this variable called "self", but where is it
coming from?  There's no global variable "self", it's not one of the
parameters to the method, and you're not defining it in the method.

Does that help at all?

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


Re: [Tutor] Methods and classes

2006-09-13 Thread Kent Johnson
Chris Hengge wrote:
> The deitel book has a note on page 229:
>   Failure to specify an object reference (usually called self) as the
> first parameter in a method definition causes fatal logic errors when
> the method is invoked at runt-ime.
> 
> Now I've got methods all over the place among several scripts that don't
> use self, and each other works fine as I'd expect. 

You have to distinguish between a method (a function that is part of a 
class definition) and a standalone function (not part of any class). 
Python allows both. Standalone functions don't have a 'self' parameter; 
class methods always do (you can give it a different name but if you 
omit it you will get a runtime error when you call the method).

Kent

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


Re: [Tutor] Methods and classes

2006-09-13 Thread Chris Hengge
On Wed, 2006-09-13 at 18:26 -0400, Kent Johnson wrote:
> Chris Hengge wrote:
> > The deitel book has a note on page 229:
> > Failure to specify an object reference (usually called self) as the
> > first parameter in a method definition causes fatal logic errors when
> > the method is invoked at runt-ime.
> > 
> > Now I've got methods all over the place among several scripts that don't
> > use self, and each other works fine as I'd expect. 
> 
> You have to distinguish between a method (a function that is part of a 
> class definition) and a standalone function (not part of any class). 
> Python allows both. Standalone functions don't have a 'self' parameter; 
> class methods always do (you can give it a different name but if you 
> omit it you will get a runtime error when you call the method).
> 
> Kent
> 
> ___
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor

So just make sure I always declare self for methods (functions in
classes)? Is this unique to python? or do some other languages already
include self, and just hide it from the programmer? 

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


Re: [Tutor] Methods and classes

2006-09-13 Thread Kent Johnson
Chris Hengge wrote:
> On Wed, 2006-09-13 at 18:26 -0400, Kent Johnson wrote:

>> You have to distinguish between a method (a function that is part of a 
>> class definition) and a standalone function (not part of any class). 
>> Python allows both. Standalone functions don't have a 'self' parameter; 
>> class methods always do (you can give it a different name but if you 
>> omit it you will get a runtime error when you call the method).
>>
>> Kent
>>
> So just make sure I always declare self for methods (functions in
> classes)? Is this unique to python? or do some other languages already
> include self, and just hide it from the programmer? 

All the OO languages I know have a similar concept. Python is more 
explicit than most. Java has a 'this' variable that is magically defined 
in the scope of any method. For most accesses to member variables and 
methods you don't even have to specify 'this' - the language figures it 
out for you. Ruby uses a naming convention to refer to attributes inside 
a method (attribute names start with @)

One of the guiding principles of Python is "explicit is better than 
implicit" and the explicit declaration and use of 'self' is consistent 
with this.

Kent

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


[Tutor] Input mask for console?

2006-09-13 Thread Chris Hengge
I need either a way to mask the input from a console, or a method to not
display the typed characters to the screen. Someone point me in the
right direction?

Thanks. 

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


Re: [Tutor] Input mask for console?

2006-09-13 Thread Kent Johnson
Chris Hengge wrote:
> I need either a way to mask the input from a console, or a method to not
> display the typed characters to the screen. Someone point me in the
> right direction?

getpass.getpass() ?

Kent

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


Re: [Tutor] Input mask for console?

2006-09-13 Thread Chris Hengge
nevermind.. figured it out.. Thanks.

On Wed, 2006-09-13 at 19:48 -0400, Kent Johnson wrote:
> Chris Hengge wrote:
> > I need either a way to mask the input from a console, or a method to not
> > display the typed characters to the screen. Someone point me in the
> > right direction?
> 
> getpass.getpass() ?
> 
> 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] Input mask for console?

2006-09-13 Thread Chris Hengge
I'm assuming I can use that like

usrpass = getpass.getpass(raw_input("Password: ")) 

On Wed, 2006-09-13 at 19:48 -0400, Kent Johnson wrote:
> Chris Hengge wrote:
> > I need either a way to mask the input from a console, or a method to not
> > display the typed characters to the screen. Someone point me in the
> > right direction?
> 
> getpass.getpass() ?
> 
> 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] List manipulation

2006-09-13 Thread Bob Gailer
try this:

 >>> test = ['10\t15', '16\t20', '25\t35', '45\t50','55\t60', '61\t65', 
'75\t80']
 >>> t='\t'.join(test).split('\t')
 >>> t
['10', '15', '16', '20', '25', '35', '45', '50', '55', '60', '61', '65', 
'75', '80']
 >>> t2=[int(i) for i in t]
 >>> t2
[10, 15, 16, 20, 25, 35, 45, 50, 55, 60, 61, 65, 75, 80]
 >>> l= t2[0]
 >>> for i in range(1,len(t2)-1,2):
... if t2[i+1]-t2[i]>1:
... print l, '\t', t2[i]
... l = t2[i+1]
10 20
25 35
45 50
55 65
 >>> print l, '\t', t2[-1]
75 80

-- 
Bob Gailer
510-978-4454

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


Re: [Tutor] Methods and classes

2006-09-13 Thread Luke Paireepinart
[snip some]
>> So just make sure I always declare self for methods (functions in
>> classes)? Is this unique to python? or do some other languages already
>> include self, and just hide it from the programmer? 
>> 
>
> All the OO languages I know have a similar concept. Python is more 
> explicit than most. Java has a 'this' variable that is magically defined 
> in the scope of any method. For most accesses to member variables and 
> methods you don't even have to specify 'this' - the language figures it 
> out for you. Ruby uses a naming convention to refer to attributes inside 
> a method (attribute names start with @)
[snip some more]

Note that you can call the class instance that's passed around to the 
functions whatever you want.

'self','fish', 'banana', 'octopus', 's'.
However, if you attempt to name it something other than 'self', or occasionally 
's',
other programmers might get scared.  Especially if you name it 'int' or 
something :)

HTH,
-Luke
> 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