don arnold | 1 Jan 07:17 2004
Picon

Re: Questor

----- Original Message -----
From: "moore william" <red_necks25 <at> yahoo.com>
To: "Python" <Tutor <at> python.org>
Sent: Tuesday, December 30, 2003 1:54 PM
Subject: [Tutor] Questor

> Did anyone every find the anwser to Questor.py?

Since no one has responded yet, I'll bite: What is Questor.py, and what was
the question?

Don

_______________________________________________
Tutor maillist  -  Tutor <at> python.org
http://mail.python.org/mailman/listinfo/tutor

SSokolow | 1 Jan 07:20 2004

Modfying Proxy, HTTP 1.1, and chunked mode

I enjoy reading the Anime Addventure ( 
http://addventure.bast-enterprises.de ) but the sheer size of it makes 
it difficult to track where I've been. After finding that my usual 
method (write a CGI Proxy in Perl) was unsatisfactory, I decided to 
start into python.

After a few failed attempts to write a proxy from scratch ( no surprise 
considering that it's my first project ), I managed to find Munchy by 
Neil Schemenauer and Tiny HTTP Proxy by Suzuki Hisao. I decided to use 
Tiny HTTP Proxy and I've completely commented the code (great learning 
experience) and made some improvements.

I did manage to implement the non-expiring page history but I don't want 
to limit the proxy to HTTP 1.0 and I don't know of any easy way to 
modify a HTTP 1.1 chunked data stream. My goal is to wrap any link I've 
already visited in <strike></strke> tags but all I can do so far is have 
the Python console print "You have already been to %s".

*My question:*
   Is there any simple way to apply the requred changes to Tiny HTTP 
Proxy (  
http://mail.python.org/pipermail/python-list/2003-June/168957.html ) or 
do I have to go with one of the more complicated proxies on sourceforge? 
I just want something that will give me a secondary non-expiring history 
list within the confines of addventure.bast-enterprises.de and provide a 
platform for some other features in the future.

You can get the sources as 
http://leary.csoft.net/~ssokolow/python/pyAddWrap.zip since I thought 
that they were a little too long to be attached inline and I don't know 
(Continue reading)

Alan Gauld | 1 Jan 11:24 2004
Picon

Re: Saving Data


> I am lookign for a toutorial on how to save data
> created in a program so that it can be used when the
> parogram is started again. 

Try looking at the file handling topic in my tutor.

Alan G
Author of the Learn to Program web tutor
http://www.freenetpages.co.uk/hp/alan.gauld

_______________________________________________
Tutor maillist  -  Tutor <at> python.org
http://mail.python.org/mailman/listinfo/tutor

Alan Gauld | 1 Jan 11:33 2004
Picon

Re: mistake naming class

> class open(object):
>         def __init__(world, person, animal):
>                 open('foo.txt', 'r')
>
> Any solutions other then renaming my class, because going through
the
> code looking for calls to class open is not going to be fun

It might not be fun but you really should do it. Naming a class
after a system name is a big problem(unless you really want to
hide the system name and provide alternative functionality. Even
then its probably better to do it with an alias.

Conventionally class names start with an uppercase letter. If
you had followed the convention this problem would not have
arisen. As to changing it, use a search tool like grep to find
all of the occurences. You will have to manually validate whether
it should be a call to your class or to the system open()

Incidentally its very unusualy to name a class after a verb.
Objects are things so the class name is usually a noun. Are
you sure you need a class and not just a function? Just a
thought...

[BTW there are several modules with an open function in them,
but they are doing so deliberately, usualky with 'file-like'
objects and are a good example of why you should never use
the from foo import * style...]

Alan G
(Continue reading)

Alan Gauld | 1 Jan 11:41 2004
Picon

Re: Lambdas


> Okay well I guess I chose I bad example for lambdas, but i cant find
any
> good tutorials on them on the web.

They are covered briefly in my titor in the functional
programming topic. But for a more in depth coverage you
will need to turn to tutorials on Lisp/Scheme or other
functional languages like Haskell.

Thre is a also whole branch of math dedicated to this too, known
as lamda calculus, and it is the theoretical underpinning of
functional programming (and indeed most other programming styles too)
It depends just how dep you want to go...

> Where is an in depth tutorial on lambdas. Even though there not all
that
> necessary

lambdas are fundamental and essential, but you don't need
to use the work "lambda" to create one. In Python most
function definitions can be thought of as a lambda:

def f(x): return g(x)

is identical to the lambda form

f = lambda x: g(x)

After either we can assign the function object to another variable:
(Continue reading)

Alan Gauld | 1 Jan 11:48 2004
Picon

Re: Looking for a Python IDE


> hi everybody, can someone please suggest me a good python IDE for
Mac
> Os X ?

There's nothing as good as Pythonwin that I've seen.
You can run IDLE under X windows with some fussing around
with Tcl/Tk and fink.

But to be honest I just use the standard Mac IDE even though
its a bit primitive. Mostly I use vim (or BBEdit) and just run
the code from a Terminal session.

Alan G

_______________________________________________
Tutor maillist  -  Tutor <at> python.org
http://mail.python.org/mailman/listinfo/tutor

Alan Gauld | 1 Jan 11:45 2004
Picon

Re: writing a program in Python

> How do you actually write a program in Python?  I know
> how to use IDLE to manipulate data, but how do I write
> several lines of code that goes out and does stuff.

Can you give us an example of what you thoink of as a 
real program? Most real programs just "manipulate data".
What do you think is missing? What else would you like 
to do?

As for how to write the program physically, just use the 
File->New menu to create a blank text editor window. 
Type the code into that window and save it as a file 
of type .py. Double clicking the file in Explorer 
will run it. (You can also run it within Idle using 
the Edit->Run menu, which is handy when fixing bugs)

HTH,

Alan G
Author of the Learn to Program web tutor
http://www.freenetpages.co.uk/hp/alan.gauld

_______________________________________________
Tutor maillist  -  Tutor <at> python.org
http://mail.python.org/mailman/listinfo/tutor

Alan Gauld | 1 Jan 12:03 2004
Picon

Re: How to store key->multiple values?

> I thought of using a dictionary but I found that dictionary only
allows one > value per key.

But the value can be a list :-)

> Can I use lists instead? How do I create a multidimensional
> list or tuple? How would I insert the values into a
> multidimensional list?

Have a look at the Raw Materials topic in my tutor.

Alan G
Author of the Learn to Program web tutor
http://www.freenetpages.co.uk/hp/alan.gauld

_______________________________________________
Tutor maillist  -  Tutor <at> python.org
http://mail.python.org/mailman/listinfo/tutor

Alan Gauld | 1 Jan 12:01 2004
Picon

Re: Are there any free project to download for studying?

>  But I want to see what else Python can do.

For serious projects go to sourceforge.net
and search for projects where the
development language is Python
- there are dozens(hundreds?)

> So I want to see other good programs and
> project.

If you want to read the code then a collection of smaller programs is
found at the Useless Python
website. It is explicitly aimed at providing
beginners with little sample programs to study.

Alan G.

_______________________________________________
Tutor maillist  -  Tutor <at> python.org
http://mail.python.org/mailman/listinfo/tutor

matteo | 1 Jan 14:03 2004
Picon

Re: Looking for a Python IDE


On 01/gen/04, at 11:48, Alan Gauld wrote:

>
>> hi everybody, can someone please suggest me a good python IDE for
> Mac
>> Os X ?
>
> There's nothing as good as Pythonwin that I've seen.
> You can run IDLE under X windows with some fussing around
> with Tcl/Tk and fink.
>
> But to be honest I just use the standard Mac IDE even though
> its a bit primitive. Mostly I use vim (or BBEdit) and just run
> the code from a Terminal session.

Yesterday i've found this..
http://mail.python.org/pipermail/pythonmac-sig/2003-August/008468.html
it's similar to the carbon versione but at least has syntax-coloring !

matteo.

_______________________________________________
Tutor maillist  -  Tutor <at> python.org
http://mail.python.org/mailman/listinfo/tutor


Gmane