Re: [Tutor] [OT] triangulation

2005-11-10 Thread Alan Gauld
> Is it possible to be a programmer and not speak English? Are there any
> languages out there where the reserved words, library functions, etc.
> are in (say) German?

This is second-hand news so treat with caution but a colleague of mine used
to work for Norsk Data in Norway writing financial programs in their
proprietary language (it began with an E...) which had Norwegian
keywords.

Given he spoke no Norwegian he found it a "challenging assignment"...

Alan G 

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


[Tutor] Latin Perl

2005-11-10 Thread Matt Williams
The suprising thing about Latin Perl is that it's more
readable than normal Perl

Matt

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


Re: [Tutor] [OT] triangulation

2005-11-10 Thread Joerg Woelke
On Thu, Nov 10, 2005 at 01:55:37AM +0100, Gregor Lingl wrote:
> 
> 
> Liam Clarke-Hutchinson schrieb:
> > German is an awesome language, I love the compound words (if that's what
> > they are). What does 'Gegenuhrzeigersinn' mean in English?
> > 
> 
> counterclockwise

Try "Donaudampfschifffahrtskapitänsmützen".

More Oddities in Mark Twains wonderful "The Awful German Language".

-- 
Q:  Do you know what the death rate around here is?
A:  One per person.
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] [OT] triangulation

2005-11-10 Thread Joerg Woelke
On Thu, Nov 10, 2005 at 02:04:20PM +1300, John Fouhy wrote:
> On 10/11/05, Gregor Lingl <[EMAIL PROTECTED]> wrote:
> > but Shi Mu didn't ask for a program in English ;-)
> 
> This is pretty off-topic, but ---
> 
> Is it possible to be a programmer and not speak English? Are there any
> languages out there where the reserved words, library functions, etc.
> are in (say) German?

Dont know for sure, but perhaps Plankalkül by Konrad Zuse?

> --
> John.

-- 
In the stairway of life, you'd best take the elevator.
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] [OT] triangulation

2005-11-10 Thread Dan Klose
Hello,

On Thu, 2005-11-10 at 11:00 +0100, Joerg Woelke wrote:
> On Thu, Nov 10, 2005 at 02:04:20PM +1300, John Fouhy wrote:
> > On 10/11/05, Gregor Lingl <[EMAIL PROTECTED]> wrote:
> > > but Shi Mu didn't ask for a program in English ;-)
> > 
> > This is pretty off-topic, but ---
> > 
> > Is it possible to be a programmer and not speak English? Are there any
> > languages out there where the reserved words, library functions, etc.
> > are in (say) German?

I was bored:
http://en.wikipedia.org/wiki/Category:Non-English-
based_programming_languages

Enjoy.

Dan.
> 
> Dont know for sure, but perhaps Plankalkül by Konrad Zuse?
> 
> > --
> > John.
> 
-- 
Daniel Klose
PhD Student - Taylor Group
Mathematical Biology
National Institute for Medical Research
The Ridgeway
Mill Hill
London
NW7 1AA

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


Re: [Tutor] [Fwd: Re: Spanish text in BS problem]

2005-11-10 Thread Hugo González Monteverde
Hi Ismael,

I'm glad you found the answer. It is very enlightening as I thought I 
had to do with locale and did some tests without getting the problem (I 
do not have BS installed now)

As I speak Spanish this had got me worried. :/

Hugo



Ismael Garrido wrote:
> Found the problem myself.
> (look down)
> 
> Ismael Garrido wrote:
> 
> 
>>This is the script:
>>
>>import BeautifulSoup
>>import os
>>
>>a = open("zona.htm")
>>text = a.readlines()
>>a.close()
>>
>>BS = BeautifulSoup.BeautifulSoup(str(text))
> 
> 
> Apparently, str(text) is the cause of the problem. If instead I do: 
> "".join(text) it all works allright. I guess this is because str 
> converts 'ó' to '\xf3' while "".join() does not change the strings in 
> any way. Now the output from BS makes sense.
> 
> Bye,
> Ismael
> 
> 
>>for ed in BS('span', {'class':'ed_ant_fecha'}):
>>   fecha = ed.next.split(" ")[1].replace(".","-")
>>   urlynombre = ed.findNextSibling().findNextSibling().findNextSibling()
>>   url = 'http://espectador.com/' + urlynombre.get('href')
>>   nombre = urlynombre.next.next
>>
>>   print url
>>   print "D:/dolina/"+fecha, nombre
>>   print
>>###end
> 
> 
> 
> ___
> 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] python watchfolder as daemon

2005-11-10 Thread Frank Hoffsümmer
Hello all,
I found this gem of a python recipe that allows me to monitor a hierarchy of
folders on my filesystem for additions / changes / removals of files: 
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/215418

I would like to monitor a folder hierarchy using this script but now I
wonder what would be the best way to have this watchfolder script running at
all times in the background?

nohup python watchfolder.py myfolder &

? would that be suitable?? or is there a way to launch a process like that
from python that detaches itself from the shell?
what would be the best way, any insight or recommendation is very much
appreciated
thanks,
-frank


-- 
Lust, ein paar Euro nebenbei zu verdienen? Ohne Kosten, ohne Risiko!
Satte Provisionen für GMX Partner: http://www.gmx.net/de/go/partner
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] ftp transfer - queue & retry pattern

2005-11-10 Thread Frank Hoffsümmer
Hello,
I want to write a module that transfers a given file to a given destination
with a given protocol (ftp, sftp, scp)
to start out, just ftp would be sufficient
the destination machines are sometimes unavailable, or the transfer fails
sometimes due to connection problems

I have several questions (sorry):
1) python ftplib or curl via commands.getoutput(...)? what are the 
benefits
/ drawbacks (portability is not an issue for me, and I like curl a lot)
2) Is there a simple way to create a subprocess(?) that I can dispatch 
my
transfer jobs to from my main script. 
 The goal is that my main script can proceed without beeing hung by 
the
transfer process
3) that subprocess would need a queue, that collects all transfer jobs. 
can
you give me some hints on how that could be done in python
4) the subprocess (?) would try to transfer all jobs one after another
 if one transfer fails, retry after a certain time period (say 2, 5,
10, 20, 40 min) and stop after maxnum retries
how could I code this nicely in python without resorting to if then
else etc?

or is there a module that does 1)-4) out there somewhere already?
thanks for any insight you might have
-frank


-- 
10 GB Mailbox, 100 FreeSMS/Monat http://www.gmx.net/de/go/topmail
+++ GMX - die erste Adresse für Mail, Message, More +++
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] python watchfolder as daemon

2005-11-10 Thread Alex Hunsley
Frank Hoffsümmer wrote:

>Hello all,
>I found this gem of a python recipe that allows me to monitor a hierarchy of
>folders on my filesystem for additions / changes / removals of files: 
>http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/215418
>
>I would like to monitor a folder hierarchy using this script but now I
>wonder what would be the best way to have this watchfolder script running at
>all times in the background?
>
>nohup python watchfolder.py myfolder &
>
>? would that be suitable?? or is there a way to launch a process like that
>from python that detaches itself from the shell?
>  
>
Using nohup should certainly work fine.
Make sure you understand what happens to any standard (etc.) output  
from your script when you use it with nohup - i.e. read the nohup man page!
alex



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


Re: [Tutor] triangulation

2005-11-10 Thread Alex Hunsley
Alan Gauld wrote:

>>As in Pythagoras?
>>
>>
>
>  
>
>>Or as in triangulation on a 2D surface, navigation etc.?
>>
>>
>
>  
>
>>Or, do you mean radio triangulation by directional signal propagation
>>
>>
>
>  
>
>>Or, do you mean drawing a triangle in Tkinter?
>>
>>
>
>Or even triangulation of currency from EU currency to EU currency 
>via the euro?
>
>See:
>http://www.sysmod.com/eurofaq.htm#Triangulation
>
>Alan G.
>  
>
This Shi Mu character is a little frustrating. They won't even respond 
to peoples polite responses for clarification
Hit'n'run help requests.


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


[Tutor] logging to a database

2005-11-10 Thread captnswing
Hello all,
I would like to log messages to a database (mysql)
I found the example log_test14.py that comes with python logging  
module http://www.red-dove.com/python_logging.html
but that example is a bit greek for me ... :) and it doesnt work with  
mysql
is there some kind of tutorial how to get going if you want to log to  
a database?
thanks,
-frank

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


[Tutor] Finding wich word matched in a OR re

2005-11-10 Thread Bernard Lebel
Hello,

I have compiled this regular expression, with 3 strings. Basically it
looks like this.

r'word1|word2|word3'

The point is to try to match one of these words in a string.


Now let say I indeed got a match in a string. How can I find out wich
one, between word1-word2-word3 has the string been matched to?


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


Re: [Tutor] Finding wich word matched in a OR re

2005-11-10 Thread Bernard Lebel
Never mind, just came accross "groups" of the match object. Can't
believe there is such a nice feature!


Cheers
Bernard




On 11/10/05, Bernard Lebel <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I have compiled this regular expression, with 3 strings. Basically it
> looks like this.
>
> r'word1|word2|word3'
>
> The point is to try to match one of these words in a string.
>
>
> Now let say I indeed got a match in a string. How can I find out wich
> one, between word1-word2-word3 has the string been matched to?
>
>
> Thanks
> Bernard
>
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Finding wich word matched in a OR re

2005-11-10 Thread Kent Johnson
Bernard Lebel wrote:
> Hello,
> 
> I have compiled this regular expression, with 3 strings. Basically it
> looks like this.
> 
> r'word1|word2|word3'
> 
> The point is to try to match one of these words in a string.
> 
> Now let say I indeed got a match in a string. How can I find out wich
> one, between word1-word2-word3 has the string been matched to?

A successful search returns a match object. You can query the match to find out 
what it matched; match.group() will give the whole matched string. See
http://docs.python.org/lib/match-objects.html
for details.

Kent

-- 
http://www.kentsjohnson.com

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


Re: [Tutor] python watchfolder as daemon

2005-11-10 Thread Hugo González Monteverde
Hi, I do this all the time. I use a recipe, and import a daemon module.

The module is here:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/278731

in your script, just do

import daemon

and

daemon.createDaemon()

Works like a charm.

Hugo


Frank Hoffsümmer wrote:
> Hello all,
> I found this gem of a python recipe that allows me to monitor a hierarchy of
> folders on my filesystem for additions / changes / removals of files: 
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/215418
> 
> I would like to monitor a folder hierarchy using this script but now I
> wonder what would be the best way to have this watchfolder script running at
> all times in the background?
> 
> nohup python watchfolder.py myfolder &
> 
> ? would that be suitable?? or is there a way to launch a process like that
> from python that detaches itself from the shell?
> what would be the best way, any insight or recommendation is very much
> appreciated
> thanks,
> -frank
> 
> 
> 
> 
> 
> 
> ___
> 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] (no subject)

2005-11-10 Thread Jeff Peery
 
 
		 Yahoo! FareChase - Search multiple travel sites in one click.

 

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


[Tutor] (no subject)

2005-11-10 Thread Jeff Peery
 
 
		 Yahoo! FareChase - Search multiple travel sites in one click.

 

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


[Tutor] numeric typeError

2005-11-10 Thread Jeff Peery
hello, I'm getting this strange error:
 

myArray1[1:2]   = myArray2[3:4]
 
TypeError: Array can not be safely cast to required type
 
everytime I try to copy a slice from one array to the next this error occurs. the slices are the same size and I initialized the arrays using Numeric.zeros(10, 'Float').
 
anyone have an idea why this happens? thanks.
 
Jeff
		 Yahoo! FareChase - Search multiple travel sites in one click.

 

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


Re: [Tutor] triangulation

2005-11-10 Thread Shi Mu
the Internet is down for one day and so wonderful to have so many
responses. i have checked all the links you guys mentioned. what i
want is delaunay triangulation and the available ones online are
written in C, Java and FORTRAN. I want to see some in Python because
it is hard for me to figure out using python to do Fortune's sweeping
line algorithm. Is python is not good in doing that kind of
computation or some other reason?
Thanks a lot for all of your responses!!!

On 11/9/05, Gregor Lingl <[EMAIL PROTECTED]> wrote:
>
>
> Alex Hunsley schrieb:
> > Shi Mu wrote:
> >
> >
> >>is there any sample code of triangulation? many thanks!
> >>
> >>
> >
> > Yes, probably.
> >
>
>
> Indeed, there is.
> See attachment
>
> regards
> Gregor
>
> >
> > ___
> > Tutor maillist  -  Tutor@python.org
> > http://mail.python.org/mailman/listinfo/tutor
> >
> >
>
> --
> Gregor Lingl
> Reisnerstrasse 3/19
> A-1030 Wien
>
> Telefon: +43 1 713 33 98
> Mobil:   +43 664 140 35 27
>
> Website: python4kids.net
>
>
> ## Run this program and create a polygon without
> ## intersecting edges by clicking the vertices with the mouse
>
> from Tkinter import *
>
> def area2(A,B,C):
> """2 * Flaeche des 2D-Dreiecks ABC"""
> return (A[0]-C[0])*(B[1]-C[1]) - (A[1]-C[1])*(B[0]-C[0])
>
> def insideTriangle(A, B, C, P):
> """Liegt P im Dreieck ABC?,
> ABC sind im Gegenuhrzeigersinn angenommen!"""
> return area2(A,B,P)>=0 and area2(B,C,P)>=0 and area2(C,A,P)>=0
>
> def triangulate(poly):
> tri = []
> while len(poly) > 2:
> triaFound = False
> count = 0
> while not triaFound and count < len(poly): #n:
> count += 1
> A, B, C = poly[:3]
> if area2(A, B, C) >= 0:
> for P in poly[3:]:
> if insideTriangle(A,B,C,P):
> break
> else:
> tri.append( (A,B,C) )
> poly.remove(B)
> triaFound = True
> poly.append(poly.pop(0))
> if count == len(poly): # n:
> print "Not a simple polygon"
> return None
> return tri
>
>
> class CvDefPoly(Canvas):
> def __init__(self, root):
> Canvas.__init__(self, root, bg="white", cursor="crosshair")
> self.v = ()
> self.rWidth, self.rHeight = 10.0, 7.5
>
> self.bind("", self.repaint)
> self.bind("", self.mousePressed)
>
> self.done = False
>
> def mousePressed(self, event):
> if self.done:
> self.done = False
> self.v = ()
> x ,y = self.fx(event.x), self.fy(event.y)
> if self.v:
> x0, y0 = self.v[:2]
> if abs(x-x0) self.done = True
> if not self.done:
> self.v += (x,y)
> self.repaint(None)
>
> def iX(self,x):
> return self.centerX + x/self.pixelSize
> def iY(self,y):
> return self.centerY - y/self.pixelSize
> def fx(self,x):
> return (x-self.centerX)*self.pixelSize
> def fy(self,y):
> return (self.centerY - y)*self.pixelSize
>
> def repaint(self, event):
> items = self.find_all()
> for item in items:
> self.delete(item)
> if event:
> self.w, self.h = event.width, event.height
> w,h = self.w, self.h
> self.minX = self.minY = 2.0
> self.maxX, self.maxY = w-3.0, h-3.0
> dx, dy = self.maxX-self.minX, self.maxY-self.minY
> self.centerX = 2.0 + dx/2.0
> self.centerY = 2.0 + dy/2.0
> self.pixelSize = max(self.rWidth/dx, self.rHeight/dy)
>
> left = self.iX(-self.rWidth/2.0)
> right = self.iX(self.rWidth/2.0)
> bottom = self.iY(-self.rHeight/2.0)
> top = self.iY(self.rHeight/2.0)
>
> self.create_rectangle(left,top,right,bottom, outline="red")
> if len(self.v) > 1:
> x,y = self.v[:2]
> self.create_rectangle(self.iX(x)-2, self.iY(y)-2,
>   self.iX(x)+2, self.iY(y)+2, outline="green")
> if len(self.v) > 3:
> if self.done:
> v = []
> sv = self.v[:]
> while sv:
> a,b=sv[:2]
> v.extend([self.iX(a), self.iY(b)])
> sv = sv[2:]
> self.create_polygon( v, fill="", outline="blue")
> else:
> coo = list(self.v[2:])
> while coo:
> x1,y1 = coo[:2]
> self.create_line(self.iX(x),self.iY(y),
>  self.iX(x1),self.iY(y1),fill="blue")
> x,y=x1,y1
> coo  = coo[2:]
>
> def ccw(poly):
> n = len(poly)
> k = poly.index(min(poly))
> return area2(poly[k-1], poly[k], poly[(k+1)%n]) > 0
>
> def color(n):
> return "#%02x%02x

Re: [Tutor] triangulation

2005-11-10 Thread Jason Massey
lol, 

that's just funny.

On 11/10/05, Shi Mu <[EMAIL PROTECTED]> wrote:
> the Internet is down for one day and so wonderful to have so many
> responses. i have checked all the links you guys mentioned. what i
> want is delaunay triangulation and the available ones online are
> written in C, Java and FORTRAN. I want to see some in Python because
> it is hard for me to figure out using python to do Fortune's sweeping
> line algorithm. Is python is not good in doing that kind of
> computation or some other reason?
> Thanks a lot for all of your responses!!!
>
> On 11/9/05, Gregor Lingl <[EMAIL PROTECTED]> wrote:
> >
> >
> > Alex Hunsley schrieb:
> > > Shi Mu wrote:
> > >
> > >
> > >>is there any sample code of triangulation? many thanks!
> > >>
> > >>
> > >
> > > Yes, probably.
> > >
> >
> >
> > Indeed, there is.
> > See attachment
> >
> > regards
> > Gregor
> >
> > >
> > > ___
> > > Tutor maillist  -  Tutor@python.org
> > > http://mail.python.org/mailman/listinfo/tutor
> > >
> > >
> >
> > --
> > Gregor Lingl
> > Reisnerstrasse 3/19
> > A-1030 Wien
> >
> > Telefon: +43 1 713 33 98
> > Mobil:   +43 664 140 35 27
> >
> > Website: python4kids.net
> >
> >
> > ## Run this program and create a polygon without
> > ## intersecting edges by clicking the vertices with the mouse
> >
> > from Tkinter import *
> >
> > def area2(A,B,C):
> > """2 * Flaeche des 2D-Dreiecks ABC"""
> > return (A[0]-C[0])*(B[1]-C[1]) - (A[1]-C[1])*(B[0]-C[0])
> >
> > def insideTriangle(A, B, C, P):
> > """Liegt P im Dreieck ABC?,
> > ABC sind im Gegenuhrzeigersinn angenommen!"""
> > return area2(A,B,P)>=0 and area2(B,C,P)>=0 and area2(C,A,P)>=0
> >
> > def triangulate(poly):
> > tri = []
> > while len(poly) > 2:
> > triaFound = False
> > count = 0
> > while not triaFound and count < len(poly): #n:
> > count += 1
> > A, B, C = poly[:3]
> > if area2(A, B, C) >= 0:
> > for P in poly[3:]:
> > if insideTriangle(A,B,C,P):
> > break
> > else:
> > tri.append( (A,B,C) )
> > poly.remove(B)
> > triaFound = True
> > poly.append(poly.pop(0))
> > if count == len(poly): # n:
> > print "Not a simple polygon"
> > return None
> > return tri
> >
> >
> > class CvDefPoly(Canvas):
> > def __init__(self, root):
> > Canvas.__init__(self, root, bg="white", cursor="crosshair")
> > self.v = ()
> > self.rWidth, self.rHeight = 10.0, 7.5
> >
> > self.bind("", self.repaint)
> > self.bind("", self.mousePressed)
> >
> > self.done = False
> >
> > def mousePressed(self, event):
> > if self.done:
> > self.done = False
> > self.v = ()
> > x ,y = self.fx(event.x), self.fy(event.y)
> > if self.v:
> > x0, y0 = self.v[:2]
> > if abs(x-x0) abs(y-y0) > self.done = True
> > if not self.done:
> > self.v += (x,y)
> > self.repaint(None)
> >
> > def iX(self,x):
> > return self.centerX + x/self.pixelSize
> > def iY(self,y):
> > return self.centerY - y/self.pixelSize
> > def fx(self,x):
> > return (x-self.centerX)*self.pixelSize
> > def fy(self,y):
> > return (self.centerY - y)*self.pixelSize
> >
> > def repaint(self, event):
> > items = self.find_all()
> > for item in items:
> > self.delete(item)
> > if event:
> > self.w, self.h = event.width, event.height
> > w,h = self.w, self.h
> > self.minX = self.minY = 2.0
> > self.maxX, self.maxY = w-3.0, h-3.0
> > dx, dy = self.maxX-self.minX, self.maxY-self.minY
> > self.centerX = 2.0 + dx/2.0
> > self.centerY = 2.0 + dy/2.0
> > self.pixelSize = max(self.rWidth/dx, self.rHeight/dy)
> >
> > left = self.iX(-self.rWidth/2.0)
> > right = self.iX(self.rWidth/2.0)
> > bottom = self.iY(-self.rHeight/2.0)
> > top = self.iY(self.rHeight/2.0)
> >
> > self.create_rectangle(left,top,right,bottom, outline="red")
> > if len(self.v) > 1:
> > x,y = self.v[:2]
> > self.create_rectangle(self.iX(x)-2, self.iY(y)-2,
> >   self.iX(x)+2, self.iY(y)+2,
> outline="green")
> > if len(self.v) > 3:
> > if self.done:
> > v = []
> > sv = self.v[:]
> > while sv:
> > a,b=sv[:2]
> > v.extend([self.iX(a), self.iY(b)])
> > sv = sv[2:]
> > self.create_polygon( v, fill="", outline="blue")
> > else:
> > coo = list(self.v[2:])
> > while coo:
> >   

[Tutor] Newbie Anxiety

2005-11-10 Thread Terry Kemmerer




I'm working on Ch. 5, "Fruitful Functions", or "How To Think Like A Computer Scientist" and I still can't count.
(Don't laugh! I can't play the violin either...)

In Basic, I would have said:

10  x = x + 1 :  print x : goto 10

run
1
2
3
etc

I don't know why, but this great UNKNOWN bothers me a lot. Maybe it is because it was the first thing I learned in Basic, 
back 20 years ago when I was actually a programmer  But I  think it goes toward visualizing how things are 
going flow and be constructed without line numbers and the venerable GOTO statement. 

How is this done in Python? (So I can stop holding my breath as I study this great languageand relax.)

Thanks,

Terry


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


Re: [Tutor] Newbie Anxiety

2005-11-10 Thread John Fouhy
On 11/11/05, Terry Kemmerer <[EMAIL PROTECTED]> wrote:
>  I'm working on Ch. 5, "Fruitful Functions", or "How To Think Like A
> Computer Scientist" and I still can't count.
>  (Don't laugh! I can't play the violin either...)
>
>  In Basic, I would have said:
>
>  10  x = x + 1 :  print x : goto 10
>
>  run
>  1
>  2
>  3
>  etc
>
>  How is this done in Python? (So I can stop holding my breath as I study
> this great languageand relax.)

Hi Terry,

There's a couple of options.

First, we could do it with a while loop.  This is not the best or the
most idiomatic way, but it's probably most similar to what you've seen
before.

 count forever
i = 0
while True:
print i
i = i + 1


Of course, we generally don't want to keep counting forever.  Maybe
we'll count up to 9.

 count to 9
i = 0
while i < 10::
print i
i = i + 1


A while loop contains an implicit "GOTO start" at the end.  At the
start, it checks the condition, and breaks out of the loop if the
condition is false.

Like i said, though, this is not idiomatic Python.  Python has for
loops which are based around the idea of iterating over a sequence. 
So, we could count to 9 like this:

 count to 9
for i in [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]:
print i


The loop will go through the list, assigning each item to i in turn,
until the list is exhausted.  The range() function is useful for
building lists like that, so we don't have to type it out manually.

 count to 9
for i in range(10):
print i


And, of course, once we've got range(), we can give it a variable
limit (eg, n = 10; range(n)).  Iteration is the key to doing all kinds
of funky stuff in python (including new ideas like geneartor
functions), so it's good to get the hang of :-)

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


Re: [Tutor] Newbie Anxiety

2005-11-10 Thread Kent Johnson
Terry Kemmerer wrote:
> In Basic, I would have said:
> 
> 10  x = x + 1 :  print x : goto 10
> 
> run
> 1
> 2
> 3
> etc
> 

> How is this done in Python? (So I can stop holding my breath as I study 
> this great languageand relax.)

In Python there is no goto, as you have discovered. Loops are constructed using 
the 'for' and 'while' statements.

A while loop will loop as long as its condition is true. If you give it a 
condition that is always true, it will create an infinite loop like yours 
above. So the equivalent Python code would be

x=0
while True:
  x = x + 1
  print x

You can read a little more about while loops here and in the next chapter of 
your book:
http://docs.python.org/tut/node5.html#SECTION00520

Now relax and forget all the bad habits from you BASIC days ;-)

Kent

-- 
http://www.kentsjohnson.com

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


Re: [Tutor] Newbie Anxiety

2005-11-10 Thread Roel Schroeven
Terry Kemmerer wrote:
> I'm working on Ch. 5, "Fruitful Functions", or "How To Think Like A
> Computer Scientist" and I still can't count.
> (Don't laugh! I can't play the violin either...)
> 
> In Basic, I would have said:
> 
> 10  x = x + 1 :  print x : goto 10
> 
> run
> 1
> 2
> 3
> etc
> 
> How is this done in Python? (So I can stop holding my breath as I study
> this great languageand relax.)

You need to choose the appropriate control structure. In this case you
need an infinite loop, which in Python is written as:

while True:
# do stuff...

Also, in Python you need to explicitly give x its initial value:

x = 0

In Python 'x = x + 1' can be written shorter as 'x += 1' (though 'x = x
+ 1') works too.

All together:

x = 0
while True:
x += 1
print x

HTH

-- 
If I have been able to see further, it was only because I stood
on the shoulders of giants.  -- Isaac Newton

Roel Schroeven

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


Re: [Tutor] Newbie Anxiety

2005-11-10 Thread Chris F.A. Johnson
On Thu, 10 Nov 2005, Terry Kemmerer wrote:

> I'm working on Ch. 5, "Fruitful Functions", or "How To Think Like A
> Computer Scientist" and I still can't count.
> (Don't laugh! I can't play the violin either...)
>
> In Basic, I would have said:
>
> 10  x = x + 1 :  print x : goto 10

Good heavens! I never used GOTO, even on the C-64:

10 for n = 1 to 10
20 print n
25 rem n = 1 rem  remove first rem for infinite loop
30 next


> run
> 1
> 2
> 3
> etc
>
> I don't know why, but this great UNKNOWN bothers me a lot. Maybe it is
> because it was the first thing I learned in Basic,
> back 20 years ago when I was actually a programmer  But I  think it
> goes toward visualizing how things are
> going flow and be constructed without line numbers and the venerable
> GOTO statement.
>
> How is this done in Python? (So I can stop holding my breath as I study
> this great languageand relax.)

n = 1
while n <= 10:
   print n
   n = n + 1


Or:

for n in [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]:
   print n


Or:

for n in range(10):
   print n + 1


Etc..


-- 
 Chris F.A. Johnson 
 ==
 Shell Scripting Recipes: A Problem-Solution Approach, 2005, Apress
 
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] triangulation

2005-11-10 Thread Danny Yoo

Hi Shi Mu,

There are some direct ways you can find a delaunay triangulation
implementation in Python.  In fact, the first Google hit to "triangulation
python" should come up with something relevant.

Also, try the search "triangulation" in:

http://www.python.org/pypi?%3Aaction=search_form

Are you having trouble accessing Google or the Web?  I mean this in all
seriousness;  do you have little experience with web search engines, or
does your ISP restrict you from accessing them?

I'm just trying to construct some reasonable explanation why you're having
difficulty finding these utilities and tools.  I'm trying to treat it the
same way I treat a software bug, by probing for causes and reasons.

Good luck to you.

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


Re: [Tutor] Newbie Anxiety

2005-11-10 Thread Alan Gauld
> In Basic, I would have said:
> 
> 10  x = x + 1 :  print x : goto 10

Tsk, tsk, even in BASIC that's considered bad form :-)

10 FOR X =1 to 10 
20 PRINT X
30 NEXT

Would be the better BASIC form.

And as you've seen Python provides a close analog to 
that in its for loop.

for X in [1,2,3,4,5,6,7,8,9,10]: 
print X

OR

for X in range(1,11): 
print X

> goes toward visualizing how things are 
> going flow and be constructed without line numbers and the venerable
> GOTO statement. 

I discuss why this is a bad idea in the old version of my tutor, which 
compared Python to old style BASIC. You might find it helpful if you 
were weaned on BASIC.  You can still find the old site here:

http://www.freenetpages.co.uk/hp/alan.gauld/oldtutor/

Check out the Loops topic for the GOTO discussion.

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


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


Re: [Tutor] Newbie Anxiety

2005-11-10 Thread Alan Gauld
> compared Python to old style BASIC. You might find it helpful if you 
> were weaned on BASIC.  You can still find the old site here:
> 
> http://www.freenetpages.co.uk/hp/alan.gauld/oldtutor/
> 
> Check out the Loops topic for the GOTO discussion.

Oops, so long since I looked at that version...
Its actually the Branching topic that discusses GOTO.

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


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


[Tutor] Newbie Anxiety

2005-11-10 Thread Terry Kemmerer




(I accidentally sent this to the originator. Sorry.)

Sweet!  

Almost everything is sooo familiar, yet, merged in many interesting ways. I never had a DO WHILE statement, but 
in many ways, your further examples are like a combination of my old FOR NEXT loop and IF logical evaluation statement put together for reading in/out lists. JUST TOO COOL! 

And it looks so CLEAN!  --compared to my old BASIC of having to name the variable belonging to each NEXT incrementation executed while keeping the code nested properly relative to each FOR NEXT loop!!!

Thanks!  THIS LOOKS GREAT!

Terry



On Fri, 2005-11-11 at 11:49 +1300, John Fouhy wrote: 


On 11/11/05, Terry Kemmerer <[EMAIL PROTECTED]> wrote:
>  I'm working on Ch. 5, "Fruitful Functions", or "How To Think Like A
> Computer Scientist" and I still can't count.
>  (Don't laugh! I can't play the violin either...)
>
>  In Basic, I would have said:
>
>  10  x = x + 1 :  print x : goto 10
>
>  run
>  1
>  2
>  3
>  etc
>
>  How is this done in Python? (So I can stop holding my breath as I study
> this great languageand relax.)

Hi Terry,

There's a couple of options.

First, we could do it with a while loop.  This is not the best or the
most idiomatic way, but it's probably most similar to what you've seen
before.

 count forever
i = 0
while True:
print i
i = i + 1


Of course, we generally don't want to keep counting forever.  Maybe
we'll count up to 9.

 count to 9
i = 0
while i < 10::
print i
i = i + 1


A while loop contains an implicit "GOTO start" at the end.  At the
start, it checks the condition, and breaks out of the loop if the
condition is false.

Like i said, though, this is not idiomatic Python.  Python has for
loops which are based around the idea of iterating over a sequence. 
So, we could count to 9 like this:

 count to 9
for i in [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]:
print i


The loop will go through the list, assigning each item to i in turn,
until the list is exhausted.  The range() function is useful for
building lists like that, so we don't have to type it out manually.

 count to 9
for i in range(10):
print i


And, of course, once we've got range(), we can give it a variable
limit (eg, n = 10; range(n)).  Iteration is the key to doing all kinds
of funky stuff in python (including new ideas like geneartor
functions), so it's good to get the hang of :-)

--
John.
___
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] Newbie Anxiety

2005-11-10 Thread Terry Kemmerer




I want to thank everyone for their responses. This has help tremendously to ease my mind. Thanks! 

Branching in the program, is actually my real anxiety, as I have been feeling the void, (maybe 
that should be WITHDRAWALS!) as I am working my way through How To Think Like a Computer 
Scientists. 

By the way, I REALLY LIKE THE BOOK! 

--However, your recommended discussion comparing against basic is going to be very helpful in 
orientating me! 

Basic was my only language (although we went through several versions) and I haven't written 
a line for almost 20 years, so, I am very rusty as it is.

Terry



> compared Python to old style BASIC. You might find it helpful if you 
> were weaned on BASIC.  You can still find the old site here:
> 
> http://www.freenetpages.co.uk/hp/alan.gauld/oldtutor/
> 
> Check out the Loops topic for the GOTO discussion.

Oops, so long since I looked at that version...
Its actually the Branching topic that discusses GOTO.

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





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


Re: [Tutor] Who called me?

2005-11-10 Thread Bill Campbell
On Tue, Nov 08, 2005, Kent Johnson wrote:
>Kent Johnson wrote:
>> Bill Campbell wrote:
>> 
>>>Is there a way in python for a method to determine its parent?
>>>
>>>In particular, I'm working with SimpleXMLRPCServer, and would
>>>like to be able to find the client_address in the routine that
>>>has been dispatched.  I know that client_address is an attribute
>>>of the handler class instance, but don't know how to get to that.
>
... good stuff deleted...

>HOWEVER, I don't think this is a good solution to your problem - it's quite
>a fragile hack. Better would be to find a way to pass the information you
>need to your function. For example, from a quick look at the code for
>SimpleXMLRPCServer, it looks like you could subclass SimpleXMLRPCServer and
>make your own _dispatch() method that adds client_address to the parameter
>list, then all your functions would be passed the client_address. Or even
>specialize it so that just one special function gets this treatment.

That's one solution that I had considered, but in this particular case, I
will probably use the CGI version of the XMLRPCServer since I can get the
information from the REMOTE_ADDR environment variable that apache will set
for me.

The problem I'm working on now is to have our client's machines connect to
our XML-RPC server in cron jobs which will do at least two things, check to
see if their dynamic IP address has changed so we can update DNS for them,
and/or let our system know they're still alive and functioning.

This part of the job is probably best handled behind apache using the
CGIXMLRPCRequestHandler as it makes some things simpler and can be done via
https.

Being fairly new to python, I wanted to know if there was a clean way to
get parent information if the author of a package hadn't provided this.  I
generally have attributes in children that point back to the parent making
it easy to get back to the parent from the child.

Bill
--
INTERNET:   [EMAIL PROTECTED]  Bill Campbell; Celestial Software LLC
UUCP:   camco!bill  PO Box 820; 6641 E. Mercer Way
FAX:(206) 232-9186  Mercer Island, WA 98040-0820; (206) 236-1676
URL: http://www.celestial.com/

``The children who know how to think for themselves spoil the harmony of
the collective society that is coming, where everyone would be
interdependent.''  1899 John Dewey, educational philosopher, proponent of
modern public schools.
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Newbie Anxiety

2005-11-10 Thread Liam Clarke-Hutchinson
Title: Message



Hi 
Terry,
 
Python 
is great, very much so if the last you used was Basic.
 
I 
highly recommend Alan Gauld's tutorial, but I look forward to your queries here. 
:-)
Liam 
Clarke-Hutchinson
-Original Message-From: 
[EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of 
Terry KemmererSent: Friday, 11 November 2005 12:25 
p.m.To: Python_TUTORSubject: [Tutor] Newbie 
Anxiety
(I accidentally sent this to the 
  originator. Sorry.)Sweet!  Almost everything is sooo 
  familiar, yet, merged in many interesting ways. I never had a DO WHILE 
  statement, but in many ways, your further examples are like a combination 
  of my old FOR NEXT loop and IF logical evaluation statement put together for 
  reading in/out lists. JUST TOO COOL! And it looks so CLEAN!  
  --compared to my old BASIC of having to name the variable belonging to each 
  NEXT incrementation executed while keeping the code nested properly relative 
  to each FOR NEXT loop!!!Thanks!  THIS LOOKS 
  GREAT!TerryOn Fri, 2005-11-11 at 11:49 +1300, John 
  Fouhy wrote: 
  On 11/11/05, Terry Kemmerer <[EMAIL PROTECTED]> wrote:
>  I'm working on Ch. 5, "Fruitful Functions", or "How To Think Like A
> Computer Scientist" and I still can't count.
>  (Don't laugh! I can't play the violin either...)
>
>  In Basic, I would have said:
>
>  10  x = x + 1 :  print x : goto 10
>
>  run
>  1
>  2
>  3
>  etc
>
>  How is this done in Python? (So I can stop holding my breath as I study
> this great languageand relax.)

Hi Terry,

There's a couple of options.

First, we could do it with a while loop.  This is not the best or the
most idiomatic way, but it's probably most similar to what you've seen
before.

 count forever
i = 0
while True:
print i
i = i + 1


Of course, we generally don't want to keep counting forever.  Maybe
we'll count up to 9.

 count to 9
i = 0
while i < 10::
print i
i = i + 1


A while loop contains an implicit "GOTO start" at the end.  At the
start, it checks the condition, and breaks out of the loop if the
condition is false.

Like i said, though, this is not idiomatic Python.  Python has for
loops which are based around the idea of iterating over a sequence. 
So, we could count to 9 like this:

 count to 9
for i in [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]:
print i


The loop will go through the list, assigning each item to i in turn,
until the list is exhausted.  The range() function is useful for
building lists like that, so we don't have to type it out manually.

 count to 9
for i in range(10):
print i


And, of course, once we've got range(), we can give it a variable
limit (eg, n = 10; range(n)).  Iteration is the key to doing all kinds
of funky stuff in python (including new ideas like geneartor
functions), so it's good to get the hang of :-)

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

 
A new monthly electronic newsletter covering all aspects of MED's work is 
now available.  Subscribers can choose to receive news from any or all of 
seven categories, free of charge: Growth and Innovation, Strategic Directions, 
Energy and Resources, Business News, ICT, Consumer Issues and Tourism.  See 
http://news.business.govt.nz 
for more details.
 
 
 

 
govt.nz - connecting you to New 
Zealand central & local government services


Any opinions expressed in this message are not necessarily those of the Ministry 
of Economic Development. This message and any files transmitted with it are 
confidential and solely for the use of the intended recipient. If you are not 
the intended recipient or the person responsible for delivery to the intended 
recipient, be advised that you have received this message in error and that any 
use is strictly prohibited. Please contact the sender and delete the message and 
any attachment from your computer. 






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


Re: [Tutor] Who called me?

2005-11-10 Thread Kent Johnson
Bill Campbell wrote:

> The problem I'm working on now is to have our client's machines connect to
> our XML-RPC server in cron jobs which will do at least two things, check to
> see if their dynamic IP address has changed so we can update DNS for them,
> and/or let our system know they're still alive and functioning.

If you have control of the code on the client machines you could just have them 
add their IP address to the parameters they send the server...

Kent

-- 
http://www.kentsjohnson.com

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


Re: [Tutor] Who called me?

2005-11-10 Thread Bill Campbell
On Thu, Nov 10, 2005, Kent Johnson wrote:
>Bill Campbell wrote:
>
>>The problem I'm working on now is to have our client's machines connect to
>>our XML-RPC server in cron jobs which will do at least two things, check to
>>see if their dynamic IP address has changed so we can update DNS for them,
>>and/or let our system know they're still alive and functioning.
>
>If you have control of the code on the client machines you could just have 
>them add their IP address to the parameters they send the server...

The problem is that the clients are often on dynamic IP addresses behind a
router/firewall that's doing NAT (Network Address Translation) so they
don't know their IP address.  One of the primary reasons for doing this is
to be able to easily and automatically detect when a dynamic IP address has
changed so we can update the DNS, postfix rules, etc. so we know where the
client is.

Bill
--
INTERNET:   [EMAIL PROTECTED]  Bill Campbell; Celestial Software LLC
UUCP:   camco!bill  PO Box 820; 6641 E. Mercer Way
FAX:(206) 232-9186  Mercer Island, WA 98040-0820; (206) 236-1676
URL: http://www.celestial.com/

The Constitution is a written instrument.  As such, its meaning
does not alter.  That which it meant when it was adopted, it
means now.
-- SOUTH CAROLINA v. US, 199 U.S. 437, 448 (1905)
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Newbie Anxiety

2005-11-10 Thread Terry Kemmerer




A good natured word of explanation for Chris and others:

Rest assured I am not criticizing the FORM and USE of white space that Python so eloquently uses, 
and subsequently makes it so beautiful and easy to read to the eye, by my example 
of a single line of BASIC. Actually, back in the day, I would never have written it the 
way I did for my question. I would have written it this way:

10 X=X+1:?X:GOTO10 

(The Computer would have automatically translated that to  10 X=X+1:PRINTX:GOTO10)

And I would have written Chris's for next loop as follows:

10 FORN=1TO10:?N:NEXTN: REM  It is bad form not to name N after NEXT to label which FOR NEXT loop is being incremented.

And I would not have been ashamed of the crunched out spaces, nor the multiple statements per line, because in the 
real world when you are building a business, you do what you need to do to get the job done. Let me explain. My 
company was writing full blown computerizations of every aspect of various kinds of companies on micro computers in the micro revolution, and replacing big IBM systems with tiny multi-user systems, and we had only 48,000 bytes of RAM CORE, of which 20,500 bytes was used for the entire operating system, which included either OS-65D or OS-65U Basic programming languages of OSI (Ohio Scientific Inc.), which left only 27,500 bytes to construct your entire program in. We were selling against the BIG machines, (WE WERE BEATING THEM OUT!) and we needed SPEED, which meant a lightning fast BASIC (which we hired Steve Jobs to create when he was a starving software engineer) and then we implemented coding in ways that sped that up further. Spaces and wasted lines that a teacher would have given me an A+ for in school (if there had been a class on it), in the real world, both cut down on the speed of execution of the program and drastically cut back on the amount of what could be accomplished in a single program, thus forcing a jump to a new program, all of which again cut down on speed of getting things done because we had to write our variables to disk before making the jump, and then reloaded them in the "chained" program next to be executed making a big PAUSE in the process of processing.  (Of course, don't forget we also had to leave room for all of the data we were going to hold in memory also..IT ALL SHARED THE SAME 27,500 bytes.

To give you an idea of how successful we were at invading BIG BLUE's turf with our tiny machines, we ended up specializing in Telephone Companies, after having written complete "turn-key" systems for many many different kinds of companies. And in all of those lines of code my company generated, which surely must be in the seven figures, GOTO, and its other versions was unabashedly and freely used because BASIC is a line-number-orientated language, and GOTO naturally follows as the size of the program increases. And I can only say to you, from a personal point of view, that the real grade for excellence that counts, is the real world reward of what happens and continues to happen with your business's bank account. Customers buy solutions that work out well for them, both in the sale and after the salethey just want it to work. And while I am sure someone is thinking Spaghetti Code, our style was highly conventionalized, something that we enforced rather strictly. What can I say? It worked out great! Maintaining the programs and adding new 
abilities was never a problem. When I sold the company, we were still writing 99% of our code in Basic. (IT WAS A VERY 
VERY VERY FAST BASIC.) So, you see, Basic was my ONLY language.

But that was the PAST. This is FINALLY the FUTURE. And while I am a bit disappointed those flying cars that were promised aren't here yet, we of the future now have the luxury of white space with no downside. It makes sense to use it as part of the programming logic. And while I am used to reading condensed code more than I am the great open spaces of programming freedom today, I will surely get used to it, and love it. My only real concern has been in how the flow of python works for the WHOLE PROGRAM FLOW, and you all have help me a lot here...and I really appreciate it. And I assure you, intend to CONFORM to how Python sees itself being written. This is, after all, the future. 

I am really looking forward to the adventure of Python. And rest assured, I read up on all the other languages first, as it is my habit to trace the path to the goal in advance of launching the ship, and nowhere do I find as much potential in the view I gained, than python affords. Which is why I am braving the waters of SOMETHING DIFFERENT, that is MUCH BETTER!

And n =+ 1 is an abbreviation that warms my heart to see!

Thanks,

Terry




On Thu, 10 Nov 2005, Terry Kemmerer wrote:

> I'm working on Ch. 5, "Fruitful Functions", or "How To Think Like A
> Computer Scientist" and I still can't count.
> (Don't laugh! I can't play the violin either...)
>
> In Basic, I would have said:
>
> 10 

Re: [Tutor] OT - Newbie Anxiety

2005-11-10 Thread Simon Gerber
>  But that was the PAST. This is FINALLY the FUTURE. And while I am a bit
> disappointed those flying cars that were promised aren't here yet, we of the
> future now have the luxury of white space with no downside.

Whaddaya mean, no flying cars?

http://www.moller.com/skycar/

Aside from that, thanks for the interested read.

Cheers!

--
Simon Gerber - Prodigi Solutions
http://www.prodigi.com.au
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] triangulation

2005-11-10 Thread Shi Mu
I see. maybe some websites are blocked to me.

On 11/10/05, Danny Yoo <[EMAIL PROTECTED]> wrote:
>
> Hi Shi Mu,
>
> There are some direct ways you can find a delaunay triangulation
> implementation in Python.  In fact, the first Google hit to "triangulation
> python" should come up with something relevant.
>
> Also, try the search "triangulation" in:
>
>http://www.python.org/pypi?%3Aaction=search_form
>
> Are you having trouble accessing Google or the Web?  I mean this in all
> seriousness;  do you have little experience with web search engines, or
> does your ISP restrict you from accessing them?
>
> I'm just trying to construct some reasonable explanation why you're having
> difficulty finding these utilities and tools.  I'm trying to treat it the
> same way I treat a software bug, by probing for causes and reasons.
>
> Good luck to you.
>
>
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] logging to a database

2005-11-10 Thread Johan Geldenhuys
Try looking here;
http://sourceforge.net/projects/mysql-python

Johan

captnswing wrote:

>Hello all,
>I would like to log messages to a database (mysql)
>I found the example log_test14.py that comes with python logging  
>module http://www.red-dove.com/python_logging.html
>but that example is a bit greek for me ... :) and it doesnt work with  
>mysql
>is there some kind of tutorial how to get going if you want to log to  
>a database?
>thanks,
>-frank
>
>___
>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] simple report writing?

2005-11-10 Thread Johan Geldenhuys
Did you manage to get something that worked for you?
Johan

CPIM Ronin wrote:

>Can someone suggest a specific tutorial strictly on report writing?
>
>I'm able to write reports fairly easily in Python. I know the stuff like 
>str(round(x,2)) where x = 3.145678 will yield 3.14. What I'm looking for is 
>to be able to control left and right justification, column by column while 
>using string and numeric data of variable lengths so that my reports look 
>much neater.
>
>Possibly a generalized def print_line(*x)?
>
>Thanks.
>
>RC
>
>_
>Express yourself instantly with MSN Messenger! Download today - it's FREE! 
>http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
>
>___
>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] two ways

2005-11-10 Thread Shi Mu
what is the difference between the two ways of assigning the list?
p=a vs. p=a[:]
>>> a=range(5)
>>> a
[0, 1, 2, 3, 4]
>>> p=a
>>> p
[0, 1, 2, 3, 4]
>>> p=a[:]
>>> p
[0, 1, 2, 3, 4]
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] two ways

2005-11-10 Thread Shi Mu
thanks!

On 11/10/05, Liam Clarke <[EMAIL PROTECTED]> wrote:
> Hi Shi,
>
> For what you're doing, nothing at all.
>
> When you use a colon, slice syntax, it defaults to [start:end] so p =
> a[:] is the same as
> p = a[0:len(a)]
>
> Regards,
>
> Liam Clarke
>
> On 11/11/05, Shi Mu <[EMAIL PROTECTED]> wrote:
> > what is the difference between the two ways of assigning the list?
> > p=a vs. p=a[:]
> > >>> a=range(5)
> > >>> a
> > [0, 1, 2, 3, 4]
> > >>> p=a
> > >>> p
> > [0, 1, 2, 3, 4]
> > >>> p=a[:]
> > >>> p
> > [0, 1, 2, 3, 4]
> > ___
> > Tutor maillist  -  Tutor@python.org
> > http://mail.python.org/mailman/listinfo/tutor
> >
>
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor