Re: [Tutor] [BULK] Tutor Digest, Vol 25, Issue 57

2006-03-23 Thread Smith
| 7. Re: efficient method to search between two lists (Srinivas Iyyer) | for i in list_b: | ... co = i.split('\t')[2] | ... items = da.get(co) ^ -| | Are you sure that all co's are in da? One other thing that occurs t

Re: [Tutor] Practice tomorrow

2006-03-23 Thread John Fouhy
On 24/03/06, Naomi Guyer <[EMAIL PROTECTED]> wrote: > Till just before 1pm would be good. That way I can make the practice at > Martin Luckie at 1pm. As a lifetime member of the Vic flying disc club, I can write you a note excusing you from being late if you like :-) -- John.

[Tutor] [Fwd: Re: i need help please read (fwd)]

2006-03-23 Thread Kent Johnson
Forwarding to the list, I don't know how to do this. Original Message Subject:Re: [Tutor] i need help please read (fwd) Date: Thu, 23 Mar 2006 19:43:07 -0800 From: Tom Bachik <[EMAIL PROTECTED]> To: Kent Johnson <[EMAIL PROTECTED]> References: <[EMAIL PROTECTED]>

Re: [Tutor] i need help please read (fwd)

2006-03-23 Thread Kent Johnson
> From: Tom Bachik <[EMAIL PROTECTED]> > To: Danny Yoo <[EMAIL PROTECTED]> > Subject: Re: [Tutor] i need help please read > > no it is not homework, i havent started y idea yet but my question for now > basicly say how do you get python to make a box pop up? you no like ask you > a question or som

Re: [Tutor] Inner Class access to outer class attributes?

2006-03-23 Thread Alan Gauld
> Ooops. I should substitute the word "brackets" with "braces". I always > get those two mixed up. Don't worry Danny, in "real English - ie as spoken in England! - there is no distinction. There are {curly brackets}, (round brackets) and [square brackets]. You also get and <> But braces are t

Re: [Tutor] Inner Class access to outer class attributes?

2006-03-23 Thread Alan Gauld
> Hmmm, so every Sublocation object has a copy of the grouplocation > data? What happens if I come around & change something: Recall that in Python variables are simply references to objects. So every sublocation has a reference to the same groupLocation object > Would I need to (forgive me here

Re: [Tutor] efficient method to search between two lists

2006-03-23 Thread Terry Carroll
On Thu, 23 Mar 2006, Kent Johnson wrote: > This is more efficient than the original algorithm because it reduces > the size of the loops to the number of matching elements rather than the > whole number of elements. But if there are a large number of matches it > will still be a lot of loops!

Re: [Tutor] i need help please read (fwd)

2006-03-23 Thread Danny Yoo
[forwarding to tutor] -- Forwarded message -- Date: Thu, 23 Mar 2006 15:15:11 -0800 From: Tom Bachik <[EMAIL PROTECTED]> To: Danny Yoo <[EMAIL PROTECTED]> Subject: Re: [Tutor] i need help please read no it is not homework, i havent started y idea yet but my question for now basicl

Re: [Tutor] Simple way for i18n ?

2006-03-23 Thread francois schnell
Thanks both for your help, I managed to find one book which talk about i18n for Python: "Python in a Nutshell" (few pages for i18n) I've used sys.prefix on my ubuntu box to find the default directory and it works fine this way: http://www.flickr.com/photos/frenchy/116742621/ I've also done like

Re: [Tutor] Renaming computers

2006-03-23 Thread John Fouhy
On 24/03/06, Danny Yoo <[EMAIL PROTECTED]> wrote: > Unfortunately, I really don't know Windows very well. I'd recommend > poking around with the win32 folks and see if it's possile to get/set the > computer name of a Windows machine. Microsoft has a repository of sample python scripts for automat

Re: [Tutor] Renaming computers

2006-03-23 Thread Christian Wyglendowski
Danny Yoo wrote: > There are examples of programs that people have written to > automate some Windows administration tasks. For example: > > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/347812 > > is code to get the MAC address of one's ethernet card You can also use WMI for thi

Re: [Tutor] Inner Class access to outer class attributes?

2006-03-23 Thread Kent Johnson
stv wrote: > Hmmm, so every Sublocation object has a copy of the grouplocation > data? No, as Danny explained it is a reference to the data, not a copy. > > Is there a better way to skin this cat? Or am I stuck with a) the > non-inner class design & it's ugly indexes > > for sub in group.sublo

Re: [Tutor] Inner Class access to outer class attributes?

2006-03-23 Thread Alan Gauld
I'm not sure why you think this needs to be an inner class? Why not just make it a peer class of GroupLocation? Then you can pass in the GroupLocation as a parent to the SubLocation constructor. The sublocation methods then reference the GroupLocation via the parent attribute: class Container(l

Re: [Tutor] Inner Class access to outer class attributes?

2006-03-23 Thread Danny Yoo
> So Curly has a list of references to friends. A model diagram of the > situation looks something like this: > > > larry --> { name,friends } > | | > V | > "Larry" [ x, x ] >

Re: [Tutor] Inner Class access to outer class attributes?

2006-03-23 Thread Danny Yoo
On Thu, 23 Mar 2006, stv wrote: > Hmmm, so every Sublocation object has a copy of the grouplocation data? Hi stv, Not exactly: each sublocation has a "reference" to the parent grouplocation. There's a distinction between a "reference" and a copy. Think of a reference as an arrow to the other

Re: [Tutor] Renaming computers

2006-03-23 Thread Danny Yoo
On Thu, 23 Mar 2006 [EMAIL PROTECTED] wrote: > Could you point me in the right direction, after we have ghosted the > machines in college we have to rename them, I would like to try and > write a program that does this through matching the MAC address with the > computer but I'm quite new to pro

Re: [Tutor] Inner Class access to outer class attributes?

2006-03-23 Thread stv
Hmmm, so every Sublocation object has a copy of the grouplocation data? What happens if I come around & change something: group.grouplocation = differentGroupLocationID Would I need to (forgive me here if I get some terms wrong) use a property (or a setter) & then loop over all the affected sublo

Re: [Tutor] Inner Class access to outer class attributes?

2006-03-23 Thread Kent Johnson
stv wrote: > # So I figure out inner classes while typing the > # first draft of this email, at least mostly > # How do I access the "outer" class attributes from > # the inner class? Unlike Java (for example), in Python an inner class doesn't have any special access to attributes of an instance

Re: [Tutor] Renaming computers

2006-03-23 Thread traceyandjoe
Hello there, Could you point me in the right direction, after we have ghosted the machines in college we have to rename them, I would like to try and write a program that does this through matching the MAC address with the computer but I'm quite new to programming and need some advice on where t

[Tutor] Inner Class access to outer class attributes?

2006-03-23 Thread stv
# So I figure out inner classes while typing the # first draft of this email, at least mostly # How do I access the "outer" class attributes from # the inner class? class GroupLocation(list): ### Note subclass of list class _Sublocation(object): def __init__(self, sublocation, action):

Re: [Tutor] html and mod_python

2006-03-23 Thread Patty
> So, replace all the 10%, 20% etc in your string > with 10%% and 20%%. > Thanks That fixed it all. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] urlopen: where are the results?

2006-03-23 Thread Alan Gauld
> >>> urlopen("http://www.kermitrose.com";) > 0x00CDD768>> > should I have assigned a name to the file by > website = urlopen(" http://www.kermitrose.com"; ) ? Yes thats the idea. Its not really a file, but its what Python calls a "file-like object" That is it behaves like a file in t

Re: [Tutor] html and mod_python

2006-03-23 Thread Tim Golden
[Patty] | I tried the following piece of code and got : | | "TypeError: not enough arguments for format string" | | tag = """ | | %s | | - | 0% | 10% | 20% [... snip similar lines ...] | """ % (selected_value,selected_value)

Re: [Tutor] html and mod_python

2006-03-23 Thread Patricia G.
Hi again! result[0] is the value i got from the database. I tried the following piece of code and got :  "TypeError: not enough arguments for format string"    if result [0] in range(0, 101, 10):     selected_value = result[0]     else:     selected_value = '-'     ta

Re: [Tutor] html and mod_python

2006-03-23 Thread Patty
Hi again! result[0] is the value i got from the database. I tried the following piece of code and got : "TypeError: not enough arguments for format string" if result [0] in range(0, 101, 10): selected_value = result[0] else: selected_value = '-' t

Re: [Tutor] urlopen: where are the results?

2006-03-23 Thread gv
On 3/23/06, Kermit Rose <[EMAIL PROTECTED]> wrote: > And I had not yet found out about the read function, so even if I had > understood > that urlopen returned a file , I still would not have know how to see the > contents > of that file. > > I will search for the read function in the tutorial

Re: [Tutor] urlopen: where are the results?

2006-03-23 Thread Kermit Rose
    From: Danny Yoo Date: 03/23/06 00:08:25 To: Kermit Rose Cc: tutor@python.org Subject: Re: [Tutor] urlopen: where are the results?      We can use 'import urllib2', or if we really want urlopen():   ## from urllib2 import urlopen ##   Thanks.     > >>> urlopen("http://ww

Re: [Tutor] Build your own web server in three lines of code

2006-03-23 Thread Kent Johnson
Ben Vinger wrote: > The nice-looking, revamped Python web site states that > you can do this, but does not go on to say how. > Does anyone know? I don't know how to do it in three lines; how about one line? ;) From a command prompt python -c "import CGIHTTPServer; CGIHTTPServer.test()" will s

Re: [Tutor] Build your own web server in three lines of code

2006-03-23 Thread Reed L. O'Brien
If you have twisted it is in 2 lines like so: $ mktap web -p --path=C:\Python24 $ twistd -f web.tap Ben Vinger wrote: > The nice-looking, revamped Python web site states that > you can do this, but does not go on to say how. > Does anyone know? > > On an OT note, I've recently seen how it

[Tutor] Build your own web server in three lines of code

2006-03-23 Thread Ben Vinger
The nice-looking, revamped Python web site states that you can do this, but does not go on to say how. Does anyone know? On an OT note, I've recently seen how it can be done in a shell script: http://www.debian-administration.org/articles/371 Ben _

Re: [Tutor] Webprogramming with the MVC pattern

2006-03-23 Thread Alan Gauld
Hi Jan, > I am about to build my first web application using the MVC > pattern. MVC can be done in many ways. Are you trying to build this from scratch or are you using some kind of Web framework such as Zope or CherryPy? > Now I am wondering which might be the best way to initialize > both a mo

Re: [Tutor] 3-D

2006-03-23 Thread Kent Johnson
linda.s wrote: > Is there any sample code to draw 3-D axis in Python. That is, we can > see X,Y,Z coordinates? There is nothing built-in to Python to do this. Google "python 3d graphics" for many possibilities. You might want to look at VPython: http://www.vpython.org/webdoc/visual/VisualIntro.ht

Re: [Tutor] Getting started - IDLE won't run

2006-03-23 Thread Shaun Ross
Hi Pujo,   Thanks for the tip. I re-installed Python in the default directory and everything is working properly now. Just goes to show what happens when you try to be too clever.   Cheers, Shaun - Original Message - From: Pujo Aji To: Shaun Ross Cc: tutor@python.org

Re: [Tutor] Getting started - IDLE won't run

2006-03-23 Thread Shaun Ross
Hi Alan, I found those references on the Python site. I tried the fixes but nothing seemed to work. I just resorted to re-installing Python to the default directory and everything is working great now. It seems that the space in pathnames (C:\Program Files\) is the big problem. I'm still a nov

Re: [Tutor] efficient method to search between two lists

2006-03-23 Thread Kent Johnson
Terry Carroll wrote: > On Wed, 22 Mar 2006, Srinivas Iyyer wrote: > > >>I cannot think of any other smart method since these >>are the only two ways I know possible. >> >>Would any one please help me suggesting a neat and >>efficient way. > > > I'm thinking: > > 1) use sets to get subsets o

Re: [Tutor] html and mod_python

2006-03-23 Thread Kent Johnson
Patty wrote: > Hi! > > I created a form in a python file that takes values selected from 6 different > drop down boxes: > > for target in all_targets: >s = s + "" >s = s + "" % target >s = s + "" >for host in hosts: >if target in ants_map[host]: >

Re: [Tutor] Simple way for i18n ?

2006-03-23 Thread Michael Lange
On Wed, 22 Mar 2006 17:41:14 +0100 "francois schnell" <[EMAIL PROTECTED]> wrote: > Hello all, > > I wish to translate a Python script from English to French. I've read the > offical documentation (python.org doc) but I must admit that I'm lost now > ... > I've found some simple explanations here

Re: [Tutor] Getting started - IDLE won't run

2006-03-23 Thread Alan Gauld
> The problem is that Python GUI (IDLE) doesn't run properly. I assume you found the stuff about enabling the firewall to allow comms to 127.0.0.1(localhost)? There is a reference to the problem on the Python web site but the fix depends on your firewall. Try disabling the firewall temporaril

Re: [Tutor] basic question

2006-03-23 Thread Alan Gauld
Hi Michael, > I loaded IDLE (python GUI) on my portable installed with Windows XPpro > but when I go in Python shell to file, and New wondow , > I do not find run or execute or something like that. First do you actually get a new blank window popping up? If so, you should find a Run menu item on

[Tutor] Webprogramming with the MVC pattern

2006-03-23 Thread Jan Eden
Hi, I am about to build my first web application using the MVC pattern. Now I am wondering which might be the best way to initialize both a model and a presenter based on the model and its state. My controller should look like this: # model = Models.ModelFactory(cgi_parameters) view =

Re: [Tutor] Getting started - IDLE won't run

2006-03-23 Thread Pujo Aji
Hello Ross,Can you see pythonw in the task manager process after you run idle ?Please look at this website concerning some firewall that can stop idle: http://www.python.org/download/releases/2.4.2/bugs/Cheers,pujoOn 3/23/06, Shaun Ross <[EMAIL PROTECTED] > wrote: Hi Group,   I'm just getting

[Tutor] Getting started - IDLE won't run

2006-03-23 Thread Shaun Ross
Hi Group,   I'm just getting started with Python. I've downloaded and installed the latest version (2.4.2 for Windows). I'm running Windows XP Prow SP2 on my Toshiba Satellite P4 Centrino 2GHz with 2GB RAM. I'm using Trend-Micro PC-Cillin 2006 anti-virus & firewall.   The problem is that Pyth

Re: [Tutor] urlopen: where are the results?

2006-03-23 Thread Alan Gauld
> Anybody care to comment on the following? > from urllib2 import * Its considered bad practice to use from foo import * but at the >>> prompt its not too bad. urlopen("http://www.kermitrose.com";) > 0x00CDD768>> Looks good. What did you expect? Alan G ___

[Tutor] 3-D

2006-03-23 Thread linda.s
Is there any sample code to draw 3-D axis in Python. That is, we can see X,Y,Z coordinates? Thanks, Linda ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor