Re: [Tutor] a shorter way to write this

2005-03-25 Thread Sean Perry
Smith, Jeff wrote: For all the talk of Python only having one way to do something which is why it's so much better than Perl, I've counted about 10 ways to do this :-) Knowing you said this at least half in jest, I still feel the need to comment. In any programming language, you have flexibility

Re: [Tutor] Python and Javascript

2005-03-25 Thread Mike Hall
On Mar 25, 2005, at 4:53 PM, Alan Gauld wrote: intrigued by Dashboard, which will be in the next OSX release. It allows you to create "widgets" which are essentially little html pages There is an API for Dashboard and I'm pretty sure MacPython will support it - it covers most of the cocoa type stuf

Re: [Tutor] Trying to use MySQLdb.cursor

2005-03-25 Thread Vicki Stanfield
>> below to print the data returned from my query, but I would like to > make >> labels at the top of the columns. How do I do this dynamically? > > You shouldn't, it makes your code very vulnarable to changes in the > database! > Its the same principle as using 'select * from...', a bad idea in >

Re: [Tutor] How to include Python Script

2005-03-25 Thread Alan Gauld
> How does one go about including Python scripts in html documents. You can only do it on Windows based IE pages. Even then theres little real advantage. The snag is the person reading your pages has to have both Python installed and active scripting enabled. Very few regular users have that.

Re: [Tutor] Python and Javascript

2005-03-25 Thread Alan Gauld
> intrigued by Dashboard, which will be in the next OSX release. It > allows you to create "widgets" which are essentially little html pages There is an API for Dashboard and I'm pretty sure MacPython will support it - it covers most of the cocoa type stuff. You might be better checking out the Ap

Re: [Tutor] Python and Javascript

2005-03-25 Thread Alan Gauld
> Ryan, I should clarify that what I'd like to do here is unrelated to > the web. I'm actually just interested in using a local html page as a > simple gui to launch python calls. So a JS event handler, say a button > click, would then call a JS function which inside of it would call a > Python fu

Re: [Tutor] Python and Javascript

2005-03-25 Thread Alan Gauld
> > If you are using WSH on Windows and have the Python active scripting > > I'm on OSX, and would be doing this through Safari most likely. oca might be capable of doing it but I know very little about oca, maybe some other Mac users can help? But I don't think it can be done inside Safari. Alan

Re: [Tutor] Tkinter and keyboard output

2005-03-25 Thread Michael Lange
On Thu, 24 Mar 2005 18:05:25 - "Igor Riabtchuk" <[EMAIL PROTECTED]> wrote: > Hi, > > I was playing around with Tkinter bindings and I got a question which is > probably not particularly bright. > > If I have the following code, it works because I specifically code a function > for keypre

Re: [Tutor] Python and Javascript

2005-03-25 Thread Mike Hall
Danny, great reply. I have looked a bit at pyObjC, and it does indeed look cool. I was however hoping to bypass that route altogether and go for the simplicity (I thought) that came with the html/js route. Perhaps a cocoa bundle is the only way to get what I'm after. Thanks, -MH On Mar 25, 2005

[Tutor] How to include Python Script

2005-03-25 Thread Terry Johnson
How does one go about including Python scripts in html documents. I have been looking it up on google but can't seem to find a suitable answer!!?? Thanks ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Python and Javascript

2005-03-25 Thread Danny Yoo
> Yikes, that sounds pretty hairy. Maybe this kind of thing is not as > straight forward as anticipated. Why HTML you say? Well I've been > intrigued by Dashboard, which will be in the next OSX release. It allows > you to create "widgets" which are essentially little html pages that do > things.

[Tutor] readline module

2005-03-25 Thread kedar thangudu
hi, I hav been working on python in developing pyshell... I am using python readline module to for the command line.. Can u help me with how to replace or erase the current readline line-buffer.. the readline module just provides a insert_text func which is appending the text to the line-buffe

Re: [Tutor] Python and Javascript

2005-03-25 Thread Mike Hall
On Mar 25, 2005, at 1:00 PM, Ryan Davis wrote: Ok, that explains a lot, but I don't know of any easy way to do have javascript talk to python. I can think of some horrible ways to do it, though. 1. Make a python web service running locally, and build up SOAP calls or HTTP posts to it. (same as I

Re: [Tutor] Python and Javascript

2005-03-25 Thread Mike Hall
On Mar 25, 2005, at 12:41 PM, Alan Gauld wrote: If you are using WSH on Windows and have the Python active scripting installed then yes. Similarly if you use IE as web browser then it can be done in a web page too. I'm on OSX, and would be doing this through Safari most likely. -MH ___

RE: [Tutor] Python and Javascript

2005-03-25 Thread Ryan Davis
Ok, that explains a lot, but I don't know of any easy way to do have javascript talk to python. I can think of some horrible ways to do it, though. 1. Make a python web service running locally, and build up SOAP calls or HTTP posts to it. (same as I suggested earlier) 2. Use XUL and pyXPCOM to

Re: [Tutor] Python and Javascript

2005-03-25 Thread Mike Hall
Ryan, I should clarify that what I'd like to do here is unrelated to the web. I'm actually just interested in using a local html page as a simple gui to launch python calls. So a JS event handler, say a button click, would then call a JS function which inside of it would call a Python function

Re: [Tutor] Python and Javascript

2005-03-25 Thread Alan Gauld
> I'm curious on whether or not JavaScript and Python can talk to each > other. Specifically, can a python function be called from within a JS > function? Admittedly this is probably more of a JavaScript than Python > question, but I'd love to know if anyone can at least point me in a > direction

Re: [Tutor] Trying to use MySQLdb.cursor

2005-03-25 Thread Alan Gauld
> below to print the data returned from my query, but I would like to make > labels at the top of the columns. How do I do this dynamically? You shouldn't, it makes your code very vulnarable to changes in the database! Its the same principle as using 'select * from...', a bad idea in production co

RE: [Tutor] Python and Javascript

2005-03-25 Thread Ryan Davis
Depends on your environment. If your js is on a webpage, you can have it make http calls to a python web service. Look for articles on XMLHttpRequest in javascript to see some examples. I don't know how else that could be done, but I imagine there are other ways. Thanks, Ryan -Original M

RE: [Tutor] a shorter way to write this

2005-03-25 Thread Danny Yoo
> jrlen balane wrote: > > basically, i'm going to create a list with 96 members but with only > > one value: > > > > list1[1,1,1,1...,1] > > > > is there a shorter way to write this one??? Hi Jrlen Balana, I wanted to ask: why do we want to make a list of 96 members, with the same value? This s

Re: [Tutor] Unique elements mapping

2005-03-25 Thread Danny Yoo
On Fri, 25 Mar 2005, Srinivas Iyyer wrote: > NameState > DrewVirginia > NoelMaryland > NikiVirginia > Adams Maryland > JoseFlorida > Monica Virginia > Andrews Maryland > > > I would like to have my ouput like this: > > Virginia : Drew,Niki,Monica > Maryland: Noel,Adams

RE: [Tutor] a shorter way to write this

2005-03-25 Thread Smith, Jeff
For all the talk of Python only having one way to do something which is why it's so much better than Perl, I've counted about 10 ways to do this :-) Jeff -Original Message- From: Sean Perry [mailto:[EMAIL PROTECTED] Sent: Friday, March 25, 2005 2:20 PM To: Tutor Tutor Subject: Re: [Tutor

Re: [Tutor] a shorter way to write this

2005-03-25 Thread Sean Perry
jrlen balane wrote: basically, i'm going to create a list with 96 members but with only one value: list1[1,1,1,1...,1] is there a shorter way to write this one??? def generateN(n): while 1: yield n I'll leave the actual list creation up to you (-: ___

[Tutor] Python and Javascript

2005-03-25 Thread Mike Hall
I'm curious on whether or not JavaScript and Python can talk to each other. Specifically, can a python function be called from within a JS function? Admittedly this is probably more of a JavaScript than Python question, but I'd love to know if anyone can at least point me in a direction to res

Re: [Tutor] a shorter way to write this

2005-03-25 Thread Kent Johnson
jrlen balane wrote: basically, i'm going to create a list with 96 members but with only one value: list1[1,1,1,1...,1] is there a shorter way to write this one??? [1] * 96 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tut

RE: [Tutor] a shorter way to write this

2005-03-25 Thread Ryan Davis
A comprehension and range? # >>> list1 = [1 for x in range(0,96)] >>> len(list1) 96 # Thanks, Ryan -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of jrlen balane Sent: Friday, March 25, 2005 2:03 PM To: Tutor Tutor Subject: [Tutor] a shorter way to write

Re: [Tutor] a shorter way to write this

2005-03-25 Thread jrlen balane
a, so thats the way to do it, a list comprehension, thanks for the info... On Fri, 25 Mar 2005 14:10:41 -0500, Gabriel Farrell <[EMAIL PROTECTED]> wrote: > how about > > manyones = [ 1 for x in range(96) ] > > > On Sat, Mar 26, 2005 at 03:02:34AM +0800, jrlen balane wrote: > > basically,

Re: [Tutor] a shorter way to write this

2005-03-25 Thread Gabriel Farrell
how about manyones = [ 1 for x in range(96) ] On Sat, Mar 26, 2005 at 03:02:34AM +0800, jrlen balane wrote: > basically, i'm going to create a list with 96 members but with only one value: > > list1[1,1,1,1...,1] > > is there a shorter way to write this one??? > ___

Re: [Tutor] a shorter way to write this

2005-03-25 Thread Peter Markowsky
Hi, On Mar 25, 2005, at 2:02 PM, jrlen balane wrote: basically, i'm going to create a list with 96 members but with only one value: list1[1,1,1,1...,1] You might want to use a list comprehension like: [1 for i in range(96)] -Pete ___ Tutor maillist -

[Tutor] a shorter way to write this

2005-03-25 Thread jrlen balane
basically, i'm going to create a list with 96 members but with only one value: list1[1,1,1,1...,1] is there a shorter way to write this one??? ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Unique elements mapping

2005-03-25 Thread Sean Perry
Srinivas Iyyer wrote: Hi all: I have a question and I request groups help please. My list has two columns: NameState DrewVirginia NoelMaryland NikiVirginia Adams Maryland JoseFlorida Monica Virginia Andrews Maryland I would like to have my ouput like this: Virginia : Drew,Ni

Re: [Tutor] Defining functions

2005-03-25 Thread Gabriel Farrell
So, as a newbie, I see this thread and I check out the PEP and I see that for future compatibility we should use sys.stdin.readline(). So I import sys to see how it works. Of course, sys.stdin.readline('type anything: ') doesn't work in quite the same way as raw_input('type anything: ') does. Th

[Tutor] Unique elements mapping

2005-03-25 Thread Srinivas Iyyer
Hi all: I have a question and I request groups help please. My list has two columns: NameState DrewVirginia NoelMaryland NikiVirginia Adams Maryland JoseFlorida Monica Virginia Andrews Maryland I would like to have my ouput like this: Virginia : Drew,Niki,Monica Maryla

Re: [Tutor] max. range of list

2005-03-25 Thread jrlen balane
thanks for the information... On Fri, 25 Mar 2005 10:26:00 -0500, Kent Johnson <[EMAIL PROTECTED]> wrote: > jrlen balane wrote: > > how many is the maximum member can a list have??? > > According to this thread > http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/2ddae82bb

Re: [Tutor] Defining functions

2005-03-25 Thread Jacob S.
Yeah. And they're thinking of removing raw_input() too. I think it's good to have a __builtin__ user input function. Why should we have to import sys everytime we want user input? Almost every program that newbies write uses it, and advanced programmers also if they're using console programs.

Re: [Tutor] max. range of list

2005-03-25 Thread Kent Johnson
jrlen balane wrote: how many is the maximum member can a list have??? According to this thread http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/2ddae82bb2c1b871/e00b7903bc887a73 the number of element in a list is stored in an int, so most likely the hard limit is 2**31-1. T

Re: [Tutor] max. range of list

2005-03-25 Thread Max Noel
On Mar 25, 2005, at 15:50, jrlen balane wrote: how many is the maximum member can a list have??? ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor As far as I know, there is no limit hard-coded in the language. So I g

[Tutor] max. range of list

2005-03-25 Thread jrlen balane
how many is the maximum member can a list have??? ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Trying to use MySQLdb.cursor

2005-03-25 Thread Liam Clarke
mySQL also has it's own metadata commands - http://dev.mysql.com/doc/mysql/en/getting-information.html Looks like you want to use the DESCRIBE command. On Fri, 25 Mar 2005 06:25:52 -0500, Kent Johnson <[EMAIL PROTECTED]> wrote: > Vicki Stanfield wrote: > > I finally gave up and used MySQLdb

Re: [Tutor] Defining functions

2005-03-25 Thread Kent Johnson
Michael Dunn wrote: Something I've always wondered: if input() is so dangerous, why is it there? What valid uses does it have in the wild? It's a mistake planned to be removed in Python 3.0, the "hypothetical future release of Python that can break backwards compatibility with the existing body of

Re: [Tutor] Trying to use MySQLdb.cursor

2005-03-25 Thread Kent Johnson
Vicki Stanfield wrote: I finally gave up and used MySQLdb to connect to my database. It connects okay, and returns data, but now I have a new question. I use the code below to print the data returned from my query, but I would like to make labels at the top of the columns. How do I do this dynamica

[Tutor] appearance of old postings

2005-03-25 Thread Gregor Lingl
Hi, there just appeared a couple of postings from a Jan 2004 thread (on primes) on this list again. (two of them by me) To me it's completely unclear why and how this could happen. Does anybody know ...? Gregor -- Gregor Lingl Reisnerstrasse 3/19 A-1030 Wien Telefon: +43 1 713 33 98 Mobil: +43 66

[Tutor] SORRY (wrong adress) - (appearance of old postings)

2005-03-25 Thread Gregor Lingl
Ooops, I put the wrong address into my recent posting, which was intended to go to the edu-sig list. Forget it! Sorry for the inconvenience, Gregor -- Gregor Lingl Reisnerstrasse 3/19 A-1030 Wien Telefon: +43 1 713 33 98 Mobil: +43 664 140 35 27 Website: python4kids.net _

Re: [Tutor] Defining functions

2005-03-25 Thread Michael Dunn
Something I've always wondered: if input() is so dangerous, why is it there? What valid uses does it have in the wild? I ask this because this confusion comes up a lot: people expect input() to return a string and it throws them when it doesn't. We all just learn to use raw_input(), and to forget

Re: [Tutor] Defining functions

2005-03-25 Thread Alan Gauld
> If I try to change the 1, 2, 3, 4 or 5 by a letter i.e. a, b, c, d, e the > programme stop functionning. I get an error message saying that > > Traceback (most recent call last): > File "C:/Python24/Example/area_cir_squ_regt.py", line 39, in -toplevel- > print_options() > File "C:/Python2

Re: [Tutor] Changing a class into a subclass

2005-03-25 Thread Alan Gauld
> > single instance (or indeed no instances because you could > > use a static method... or get really fancy and create a > > meta-class!). > > or make it a static method of Building Yes that's actually what I meant, but reading it back it sounds like I meant static Factory method Ho hum.