Re: [Tutor] Uniform 'for' behavior for strings and files

2008-06-11 Thread wesley chun
> for item in block: > > where block is a file, then item becomes each line of the file in turn > But if block in a large string (let's say the actual text that was in > the file), item becomes each character at a time. Is there a way to > have a uniform iteration irrespective of whether block is a

[Tutor] [Fwd: Re: powerball]

2008-06-11 Thread Marilyn Davis
Hi Max and everyone, Max, your reply-to only went to me. You have to work harder to get it to go to the whole list. Anyway, my advice is to post your new program and see what people say. Marilyn Original Message Subject: Re: [Tutor] pow

[Tutor] text editor for Windows?

2008-06-11 Thread Christopher Spears
I just got Python installed on my Dell laptop running Windows Vista Business. Can someone recommend a good text editor to use for Python programming? Some people seem to like PythonWin. In the past I have use ConText. Thanks! ___ Tutor mail

Re: [Tutor] Subject: Re: it is ok that object.__init__ gets called multiple times?

2008-06-11 Thread claxo
On Wed, 11 Jun 2008 20:47:48 -0400 Kent Johnson <[EMAIL PROTECTED]> wrote: > This thread has both points of view: > http://coding.derkeiler.com/Archive/Python/comp.lang.python/2004-12/4599.html > > I think if you are using super() then your classes that inherit from > object still need to call sup

Re: [Tutor] wanting to learn

2008-06-11 Thread bhaaluu
On Wed, Jun 11, 2008 at 10:48 AM, Michael yaV <[EMAIL PROTECTED]> wrote: > So, can anybody head me in the right direction with my endeavor? I've read 'Programming Python Third Edition' by Mark Lutz. O'Reilly & Assoc., 2006. ISBN 0596009259. It has a lot of stuff about doing things with the Net in

Re: [Tutor] Web Stats

2008-06-11 Thread Jeff Younker
On Jun 11, 2008, at 12:58 PM, Stephen Nelson-Smith wrote: Take a look at AWStats (not Python). Doesn't this 'only' parse weblogs? I'd still need some kind of spider to tell me all the possible resources available wouldn't I? It's a big website, with 1000s of pages. If you have pages which a

Re: [Tutor] wanting to learn

2008-06-11 Thread Che M
Hi Michael, > Since my background is web, I want to learn Python and how it relates > to the web. I have been told that I need to learn and understand the > basics in "standard/general" Python before I move onto something like > "django" but really, how much Python do I need to know before

Re: [Tutor] wanting to learn

2008-06-11 Thread bhaaluu
On Wed, Jun 11, 2008 at 11:16 AM, W W <[EMAIL PROTECTED]> wrote: > > However, my personal preference is using vi/vim (which you should have > built in on your mac, along with python). > > If you open a mac terminal window and type "vimtutor" at the prompt, > it should start the vim tutor program. T

Re: [Tutor] Subject: Re: it is ok that object.__init__ gets called multiple times?

2008-06-11 Thread Kent Johnson
On Wed, Jun 11, 2008 at 7:20 PM, claxo <[EMAIL PROTECTED]> wrote: >>OTOH why are you calling object.__init__() ? I don't think that is > needed... >Kent > > I dont know what object may do in his __init__ method, so at least calling > object.__init__(self) seems sensible. Also, the same page advis

Re: [Tutor] Controlling applications

2008-06-11 Thread Eike Welk
On Monday 09 June 2008 17:51, W W wrote: > Hi, > > I've done some cursory searches, and it doesn't appear that what I > want to do is popular, if it's even possible. > > I'm trying to control other applications via python (specifically > my web browser). > > My hope is there is some way to emulate

Re: [Tutor] Copy file as root

2008-06-11 Thread John Fouhy
On 11/06/2008, Timo <[EMAIL PROTECTED]> wrote: > Hello, I'm writing a program in Python/pyGTK and I need to be root 2 > times. The first time is to open a file, let's say menu.lst. I use > os.system('gksudo gedit /boot/grub/menu.lst'), so that works. But what > if I have a copy of the file on my

Re: [Tutor] when is object relational mapping for Python warranted?

2008-06-11 Thread Jeff Younker
Yes, it's worth it. It makes it trivial to write simple database applications. The smaller the program, the more useful they are. Both SQLObject and SQLAlchemy have their strengths and weaknesses. SQLObject will get you and going up really fast. Its really simple to create a schema and to

[Tutor] Subject: Re: it is ok that object.__init__ gets called multiple times?

2008-06-11 Thread claxo
>> In the following code the __init__ for C would end calling two times object.__init__ . >> Is this ok or I calling for trouble ? >> To make explicit some context: >>object is the std python object >>super is not suposed to be used in any subclass >Why not? This seems to me the proble

Re: [Tutor] Web Stats

2008-06-11 Thread Kent Johnson
On Wed, Jun 11, 2008 at 3:58 PM, Stephen Nelson-Smith <[EMAIL PROTECTED]> wrote: > Hello, > >>> This has to include resources which have not been visited, as the >>> point is to clean out old stuff. Ah, I missed that part. >> Take a look at AWStats (not Python). > > Doesn't this 'only' parse web

Re: [Tutor] Upgrade Python distribution 2.4 to 2.5

2008-06-11 Thread Kent Johnson
On Wed, Jun 11, 2008 at 5:31 PM, washakie <[EMAIL PROTECTED]> wrote: > > Hello, I searched the web and python.org but I haven't found a good resource > that explains how to upgrade python from 2.4 to 2.5 > > What I'm wondering is whether I'll have to start from scratch on the > installation of all

Re: [Tutor] wanting to learn

2008-06-11 Thread Python Nutter
repost as didn't reply to list first time: 2008/6/12 Michael yaV <[EMAIL PROTECTED]>: > A little background on myself. I am a web designer so I am a Mac person. I > have taught myself HTML and flash by reading manuals and a lot of trial and > error over the last 11 years. I have always wanted to

[Tutor] Upgrade Python distribution 2.4 to 2.5

2008-06-11 Thread washakie
Hello, I searched the web and python.org but I haven't found a good resource that explains how to upgrade python from 2.4 to 2.5 What I'm wondering is whether I'll have to start from scratch on the installation of all my external modules such as Numpy, Matplotlib, PyXML, etc... Could someone pl

Re: [Tutor] it is ok that object.__init__ gets called multiple times?

2008-06-11 Thread Kent Johnson
On Wed, Jun 11, 2008 at 4:05 PM, claxo <[EMAIL PROTECTED]> wrote: > In the following code the __init__ for C would end calling two times > object.__init__ . > Is this ok or I calling for trouble ? > To make explicit some context: >object is the std python object >super is not suposed to be

[Tutor] it is ok that object.__init__ gets called multiple times?

2008-06-11 Thread claxo
In the following code the __init__ for C would end calling two times object.__init__ . Is this ok or I calling for trouble ? To make explicit some context: object is the std python object super is not suposed to be used in any subclass class A(object): def __init__(self,**kwargs):

Re: [Tutor] Web Stats

2008-06-11 Thread Stephen Nelson-Smith
Hello, >> This has to include resources which have not been visited, as the >> point is to clean out old stuff. > > Take a look at AWStats (not Python). Doesn't this 'only' parse weblogs? I'd still need some kind of spider to tell me all the possible resources available wouldn't I? It's a big

Re: [Tutor] powerball

2008-06-11 Thread bob gailer
max baseman wrote: as a fun little project i scripted a powerball program. it seems to have a bug in it that i cant find. To echo Kent: tell us the expected outcome and why you think there is a bug. Also please add a comment explaining the "magic" number 146107962. Also add a comment about "pow

Re: [Tutor] powerball

2008-06-11 Thread Marilyn Davis
On Wed, June 11, 2008 9:58 am, max baseman wrote: Hi Max, Here's your code with the indents preserved. I'll make my comments with >'s. from random import randrange wins=0 win=[] count =0 while count !=5: > To loop 5 times it is better to use: > for count in range(5): > stuff you want

Re: [Tutor] powerball

2008-06-11 Thread Kent Johnson
On Wed, Jun 11, 2008 at 12:58 PM, max baseman <[EMAIL PROTECTED]> wrote: > as a fun little project i scripted a powerball program. it seems to have a > bug in it that i cant find. What does it do? What do you expect it to do? Kent ___ Tutor maillist -

Re: [Tutor] Web Stats

2008-06-11 Thread Kent Johnson
On Wed, Jun 11, 2008 at 1:10 PM, Stephen Nelson-Smith <[EMAIL PROTECTED]> wrote: > Hi, > > I've been asked to produce a report showing all possible resources in > a website, together with statistics on how frequently they've been > visited. Nothing fancy - just number and perhaps date of last visi

[Tutor] powerball

2008-06-11 Thread max baseman
as a fun little project i scripted a powerball program. it seems to have a bug in it that i cant find. from random import randrange wins=0 win=[] count =0 while count !=5: number=randrange(55)+1 win.append(number) count=count+1 powerball=randrange(42)+1 count=0 win.sort() while coun

Re: [Tutor] IDE

2008-06-11 Thread Wim De Hul
To name a few: . you can specify the keyboard behaviour (Vi, Emacs,...) . Syntax help . debugging: step, break, etc, debug I/O window . python shell I used Vi before to write all my code. Infact I still do, but for python, I use Wingware :-) Cheers! Wim On 10 Jun 2008, at 23:21, Dick Moor

[Tutor] Web Stats

2008-06-11 Thread Stephen Nelson-Smith
Hi, I've been asked to produce a report showing all possible resources in a website, together with statistics on how frequently they've been visited. Nothing fancy - just number and perhaps date of last visit. This has to include resources which have not been visited, as the point is to clean ou

Re: [Tutor] IDE

2008-06-11 Thread Tom
I use PythonWin and find the Interactive Python Window invaluable. Does anyone know which of the IDE's mentioned above have a similar feature. (I'm on Vista,sorry!) Thanks. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/t

Re: [Tutor] python gui

2008-06-11 Thread Norman Khine
I am nto an expert but this might help: http://gaeswf.appspot.com/examples/initial/flex/ Norman Gabriela Soares wrote: Greetings, I want to make a dynamic dashboard, something like: http://examples.adobe.com/flex3/labs/dashboard/main.html# but using python. Is it possible ? Thanks in

Re: [Tutor] python gui

2008-06-11 Thread W W
On Wed, Jun 11, 2008 at 8:03 AM, Gabriela Soares <[EMAIL PROTECTED]> wrote: > Greetings, > > I want to make a dynamic dashboard, something like: > > http://examples.adobe.com/flex3/labs/dashboard/main.html# > > but using python. Is it possible ? Yes. -Wayne ___

Re: [Tutor] wanting to learn

2008-06-11 Thread W W
On Wed, Jun 11, 2008 at 9:48 AM, Michael yaV <[EMAIL PROTECTED]> wrote: > A little background on myself. I am a web designer so I am a Mac person. I > have taught myself HTML and flash by reading manuals and a lot of trial and > error over the last 11 years. I have always wanted to learn a language

[Tutor] wanting to learn

2008-06-11 Thread Michael yaV
A little background on myself. I am a web designer so I am a Mac person. I have taught myself HTML and flash by reading manuals and a lot of trial and error over the last 11 years. I have always wanted to learn a language like php, asp, .net but I never took the time to learn them. I have r

Re: [Tutor] How to get a script to open a text file with Python?

2008-06-11 Thread Tom
Or this can open most things: import webbrowser webbrowser.open_new('file///' + filename) On 11/06/2008, Alan Gauld <[EMAIL PROTECTED]> wrote: > > "Terry Carroll" <[EMAIL PROTECTED]> wrote > > > > > > > If TextPad is your default txt editor just use > > > os.system("foo.txt") > > > > > > > or os

Re: [Tutor] IDE

2008-06-11 Thread Jeff Younker
On Jun 10, 2008, at 4:07 AM, Sean Novak wrote: I'm looking for the perfect IDE, preferably open source. I've installed Bluefish, which I find to be a little buggy still. I'm just starting to dive into emacs, which I feel is a little daunting. If someone has tried a few different IDEs an

Re: [Tutor] How to get a script to open a text file with Python?

2008-06-11 Thread John Chandler
Why not have python copy the text to the clipboard for you? You will need the win32 packages, which is hardly a turnoff since they are so useful. import win32clipboard win32clipboard.OpenClipboard() win32clipboard.EmptyClipboard() win32clipboard.SetClipboardText(text) win32clipboard.CloseClipboard

[Tutor] python gui

2008-06-11 Thread Gabriela Soares
Greetings, I want to make a dynamic dashboard, something like: http://examples.adobe.com/flex3/labs/dashboard/main.html# but using python. Is it possible ? Thanks in advance. Best regards, Gabriela Soares. -- Gabriela Soares "I learned that courage was not the absence of fear, but the t

Re: [Tutor] RegEx to search for the '$' symbol

2008-06-11 Thread [EMAIL PROTECTED]
thank you all. __ New Online ID Theft Protection - http://www.tiscali.co.uk/spyguard ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] RegEx to search for the '$' symbol

2008-06-11 Thread Kent Johnson
On Wed, Jun 11, 2008 at 5:35 AM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi, > Silly question but how do you use python's re module to find > dictionary items that contain the '$' symbol. There is no need to use re for this. [ v for v in d.values() if '$' in v ] will give you a list of all

Re: [Tutor] RegEx to search for the '$' symbol

2008-06-11 Thread kinuthiA muchanE
> -- > > Message: 4 > Date: Wed, 11 Jun 2008 10:35:30 +0100 (GMT+01:00) > From: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > Subject: [Tutor] RegEx to search for the '$' symbol > To: tutor@python.org > Message-ID: <[EMAIL PROTECTED]> > Content-Type: text/plain;charset="U

Re: [Tutor] static methods and class methods

2008-06-11 Thread Kent Johnson
On Wed, Jun 11, 2008 at 12:17 AM, Christopher Spears <[EMAIL PROTECTED]> wrote: tcm.foo > > > > According to the author, the result for typing in 'tcm.foo' is > > calling class method foo() > foo() is part of class: TestClassMethod Try tcm.foo() tcm.foo without parentheses is the classm

Re: [Tutor] Help python coding not working

2008-06-11 Thread Evans Anyokwu
of virus > signature database 3175 (20080611) __ > > The message was checked by ESET NOD32 Antivirus. > > http://www.eset.com > > ___ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor &

Re: [Tutor] error message with multiple inheritance

2008-06-11 Thread Kent Johnson
On Wed, Jun 11, 2008 at 2:25 AM, simone <[EMAIL PROTECTED]> wrote: > Christopher Spears ha scritto: >> Traceback (most recent call last): >> File "", line 1, in ? >> TypeError: Error when calling the metaclass bases >>Cannot create a consistent method resolution >> order (MRO) for bases B, A

[Tutor] Help python coding not working

2008-06-11 Thread Mfana-boy Msibi
How to add a delete button in your web page in Python ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] RegEx to search for the '$' symbol

2008-06-11 Thread [EMAIL PROTECTED]
Hi, Silly question but how do you use python's re module to find dictionary items that contain the '$' symbol. Thanks David ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] do I need f.close()

2008-06-11 Thread dave selby
Thanks for all your help guys, I am getting a strong consensus that f.close() should be used everywhere, reading files as well as writing files and not to rely on the PVM to do clean-up for you. The whole topic came up because I just finished reading 'learning python' 3rd edition OReilly as a refr

Re: [Tutor] when is object relational mapping for Python warranted?

2008-06-11 Thread Tim Golden
Che M wrote: I'm curious whether I should consider learning either SQLObject or SQLAlchemy, and whether my needs would be worth it. I am learning to use SQlite databases for fairly simple storage and later search, and have only recently learned about object relational mapping (ORM). "Fairly si

Re: [Tutor] static methods and class methods

2008-06-11 Thread wesley chun
tcm.foo > > > > Did I do something wrong or is this an error on the book's part? > Intuitively, the answer I received makes more sense to me. I am still unsure > of the difference of static and class methods. Can someone enlighten me? hi there, thanks for picking up the book. there ar

Re: [Tutor] Python-windows command prompt interaction?

2008-06-11 Thread Tim Golden
Trey Keown wrote: Hey all, I'm creating a program that will copy a user's internet history from Internet Explorer, and I'm having a bit of trouble. I need to get python to either initiate a command via the command prompt, or open a file with its default program (in this case, a .bat file with

Re: [Tutor] doc string format ?

2008-06-11 Thread wesley chun
> I am trying to improve my code quality and have started using doc > strings. What format do you guys use for your doc strings ? > I have 'made up' the following general format ... > > def gen_vhost(kmotion_dir): >""" >Generate the kmotion vhost file from vhost_template expanding %director

Re: [Tutor] doc string format ?

2008-06-11 Thread wesley chun
> I am trying to improve my code quality and have started using doc > strings. What format do you guys use for your doc strings ? > I have 'made up' the following general format ... > > def gen_vhost(kmotion_dir): >""" >Generate the kmotion vhost file from vhost_template expanding %director

[Tutor] Copy file as root

2008-06-11 Thread Timo
Hello, I'm writing a program in Python/pyGTK and I need to be root 2 times. The first time is to open a file, let's say menu.lst. I use os.system('gksudo gedit /boot/grub/menu.lst'), so that works. But what if I have a copy of the file on my desktop? I use shutil.copyfile() to copy the file from /b