Re: [Tutor] __new__ over __init__

2010-09-01 Thread Payal
On Tue, Aug 31, 2010 at 08:27:10AM +0200, Peter Otten wrote: > Subclasses of immutable types, e. g. tuple: That was one great example, thanks. Some doubts, a. I have seen this cls before, what does it mean? b. What does type(_) mean? Thanks a lot in advance. With warm regards, -Payal -- > >>

Re: [Tutor] __new__ over __init__

2010-09-01 Thread Alan Gauld
"Payal" wrote >>> class A(tuple): ... def __new__(cls, a, b): ... return tuple.__new__(cls, (a, b)) a. I have seen this cls before, what does it mean? It is an abbreviation for class. The first parameter to new() must be a refernce to the class. It is similar to self in an

Re: [Tutor] How to print the installed web browser

2010-09-01 Thread Alan Gauld
"Ranjith Kumar" wrote I`m using ubuntu how to find and print the installed web browsers using python scripting. How would you do it without Python scripting? Is it even possible? And on a multiuser system like Linux would you print out all the browsers installed for the current user o

Re: [Tutor] How to print the installed web browser

2010-09-01 Thread Nick Raptis
On 09/01/2010 11:17 AM, Alan Gauld wrote: "Ranjith Kumar" wrote I`m using ubuntu how to find and print the installed web browsers using python scripting. How would you do it without Python scripting? Is it even possible? And on a multiuser system like Linux would you print out all the

Re: [Tutor] How to print the installed web browser

2010-09-01 Thread Ranjith Kumar
On Wed, Sep 1, 2010 at 1:47 PM, Alan Gauld wrote: > "Ranjith Kumar" wrote > > > I`m using ubuntu how to find and print the installed web browsers using >> python scripting. >> > > How would you do it without Python scripting? > Is it even possible? > > And on a multiuser system like Linux wou

Re: [Tutor] How to print the installed web browser

2010-09-01 Thread Nick Raptis
On 09/01/2010 11:46 AM, Nick Raptis wrote: Alan, let me make a wild guess here. Ubuntu does have little "Preferred applications" config tool. I don't know how or where it stores this data, but my guess is it's the same place xdg (as in xdg-open) gets it's configuration from. This article mig

Re: [Tutor] How to print the installed web browser

2010-09-01 Thread Steven D'Aprano
On Wed, 1 Sep 2010 03:24:58 pm Ranjith Kumar wrote: > Hi all, > I`m using ubuntu how to find and print the installed web > browsers using python scripting. You already asked this question on the 9th of August, in an email titled "Need a mentor": 4) Lastly I need to know is how to print th

Re: [Tutor] Installation problem: Python 2.6.6 (32-Bit) on Windows 7 (32-Bit)

2010-09-01 Thread Steven D'Aprano
On Wed, 1 Sep 2010 02:59:18 pm Tony Cappellini wrote: > Has anyone else had problems running the msi for Python 2.6.6 on > Windows 7? Sorry, I'm not a Windows guy, I can't help. You might have more luck on the python-l...@python.org mailing list, which is also available on comp.lang.python: htt

Re: [Tutor] polymorphism for file-like objects

2010-09-01 Thread Steven D'Aprano
On Wed, 1 Sep 2010 09:24:23 am Gregory, Matthew wrote: > Hi all, > > In the 2nd edition of Python Cookbook, Mark Lutz writes the intro to > Chapter 2 (Files) and gives the following example of polymorphism for > file like objects (adapted for brevity): [...] > I understand this code and the polymor

[Tutor] P2PU Beginning Python Webservices

2010-09-01 Thread pa yo
I thought some of you might be interested in this course: http://www.p2pu.org/webcraft/beginning-python-webservices ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

[Tutor] Exec function problem

2010-09-01 Thread Currall, Andrew
Using Python 2.5. DemandModel.py is a valid, working python script. If I create another script file, then: execfile('DemandModel.py') works fine. However, the apparently similar: def runfile(): execfile('DemandModel.py') runfile() doesn't, for no apparent reason: I get File "Demand

Re: [Tutor] How to print the installed web browser

2010-09-01 Thread Alan Gauld
"Nick Raptis" wrote Ooops! Sorry if I caused any confusion, I thought the goal was to print the default browser, not all of the installed ones. Silly me. Still, the "Preferred applications" tool seems to know that info (so to give you a choice) so it might be something to dig into. The prob

Re: [Tutor] Exec function problem

2010-09-01 Thread Alan Gauld
"Currall, Andrew" wrote DemandModel.py is a valid, working python script. If I create another script file, then: execfile('DemandModel.py') You probably shouldn't. You should probably be importing it. Is there a reason why you want to use execfile()? Its nearly always the wrong solution.

Re: [Tutor] How to print the installed web browser

2010-09-01 Thread Mark Weil
Not perfect, but you could check for each browser's binary. import os os.path.isfile("/usr/bin/firefox") ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] How to print the installed web browser

2010-09-01 Thread Steve Willoughby
On 01-Sep-10 13:10, Mark Weil wrote: Not perfect, but you could check for each browser's binary. import os os.path.isfile("/usr/bin/firefox") You'd probably be better off at least looking at the user's PATH variable, which would likely catch platform variations in where the browser would be

Re: [Tutor] How to print the installed web browser

2010-09-01 Thread Alan Gauld
"Steve Willoughby" wrote Not perfect, but you could check for each browser's binary. import os os.path.isfile("/usr/bin/firefox") But then you have to know of all browsers and thats almost impossible. And what if the user has built their own browser - I've written at least 3 web browsers