Re: Shipping Executables

2010-02-16 Thread Steve Holden
Philip Semanchuk wrote: > > On Feb 16, 2010, at 4:41 PM, rodmc wrote: > >> Hi, >> >> I have been merrily programming away in Python now for a few years and >> have a couple of applications I would like to possibly publish at some >> point - with the exception of certain libraries they are more or

Re: Shipping Executables

2010-02-16 Thread Steven D'Aprano
On Wed, 17 Feb 2010 02:00:59 -0500, geremy condra quoted Banibrata Dutta : >> BTW for people who are non-believers in something being worth stealing >> needing protection, need to read about the Skype client. Pardon me for breaking threading, but the original post has not come through to my prov

Re: The future of "frozen" types as the number of CPU cores increases

2010-02-16 Thread Steven D'Aprano
On Tue, 16 Feb 2010 21:09:27 -0800, John Nagle wrote: > Yes, we're now at the point where all the built-in mutable types > have "frozen" versions. But we don't have that for objects. It's > generally considered a good thing in language design to offer, for user > defined types, most of the f

Re: Shipping Executables

2010-02-16 Thread Steve Holden
geremy condra wrote: [...] > I'd worry about developing a product worth stealing before I > worried about people stealing it ;) > > Geremy Condra +1 FAQ entry! regards Steve -- Steve Holden +1 571 484 6266 +1 800 494 3119 PyCon is coming! Atlanta, Feb 2010 http://us.pycon.org/ Hol

Re: Shipping Executables

2010-02-16 Thread geremy condra
On Wed, Feb 17, 2010 at 1:10 AM, Banibrata Dutta wrote: > > > On Wed, Feb 17, 2010 at 7:41 AM, Steven D'Aprano > wrote: >> >> > security aspects I guess it would also not be much use, is this correct? >> Absolutely 100% wrong. It is an fundamental principle of security that >> you must not assume

Re: The future of "frozen" types as the number of CPU cores increases

2010-02-16 Thread Alf P. Steinbach
* Paul Rubin: John Nagle writes: However, things have changed, and lists and tuple *are* effectively mutable and hashable versions of each other... It's the concurrency aspect of this that interests me, though. A language with immutable objects can potentially handle concurrency more safely

Re: Shipping Executables

2010-02-16 Thread Banibrata Dutta
On Wed, Feb 17, 2010 at 7:41 AM, Steven D'Aprano < ste...@remove.this.cybersource.com.au> wrote: > > security aspects I guess it would also not be much use, is this correct? > > Absolutely 100% wrong. It is an fundamental principle of security that > you must not assume that the enemy is ignorant

Re: The future of "frozen" types as the number of CPU cores increases

2010-02-16 Thread Paul Rubin
John Nagle writes: >> However, things have changed, and lists and tuple *are* effectively >> mutable and hashable versions of each other... >It's the concurrency aspect of this that interests me, though. > A language with immutable objects can potentially handle concurrency > more safely than

Re: The future of "frozen" types as the number of CPU cores increases

2010-02-16 Thread John Nagle
Terry Reedy wrote: On 2/16/2010 3:15 PM, John Nagle wrote: In the beginning, Python had some types which were "frozen", > and some which weren't. In the beginning, there was only one 'frozen' general purpose collection type, the tuple. And Guido resisted the suggestion that lists and tuple

Re: Is there a simple way to find the list index to the max value?

2010-02-16 Thread TomF
On 2010-02-16 11:44:45 -0800, a...@pythoncraft.com (Aahz) said: In article <4b7a91b1.6030...@lonetwin.net>, steve wrote: On 02/16/2010 05:49 PM, W. eWatson wrote: See Subject. a = [1,4,9,3]. Find max, 9, then index to it, 2. The most obvious would be a.index(max(a)). Is that what you wante

Re: Which mock library do you prefer?

2010-02-16 Thread Ben Finney
Lacrima writes: > And I have already refused to write totally isolated tests, because it > looks like a great waste of time. It only looks like that until you chase your tail in a long, fruitless debugging session because (you later realise) the behaviour of one test is being affected by another

Is there a simple way to find the list index to the max value?

2010-02-16 Thread W. eWatson
See Subject. a = [1,4,9,3]. Find max, 9, then index to it, 2. -- http://mail.python.org/mailman/listinfo/python-list

Re: Download unnamed web image?

2010-02-16 Thread John Bokma
galileo228 writes: > On Feb 16, 9:40 pm, galileo228 wrote: [...] > I've now fixed the foo3 issue, and I now know that the problem is with > the urllib.urlretrieve line (see above). This is the error msg I get > in IDLE: > > Traceback (most recent call last): > File "/Users/Matt/Documents/pyt

Re: Download unnamed web image?

2010-02-16 Thread Matthew Barnett
galileo228 wrote: On Feb 16, 9:40 pm, galileo228 wrote: On Feb 16, 8:48 pm, John Bokma wrote: galileo228 writes: Using BeautifulSoup, mechanize, and urllib, I've constructed the following: br.open("http://www.school.edu/students/facebook/";) br.select_form(nr = 1) br.form['fulltextsearch

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-16 Thread David Cournapeau
On Wed, Feb 17, 2010 at 4:41 AM, Andrej Mitrovic wrote: > > Gary's friend Geoffrey Grosenbach says in his blog post (which Gary > linked to): "Python has no comparable equivalent to Ruby’s do end > block. Python lambdas are limited to one line and can’t contain > statements (for, if, def, etc.). W

Re: Download unnamed web image?

2010-02-16 Thread galileo228
On Feb 16, 9:40 pm, galileo228 wrote: > On Feb 16, 8:48 pm, John Bokma wrote: > > > > > galileo228 writes: > > > Using BeautifulSoup, mechanize, and urllib, I've constructed the > > > following: > > > > br.open("http://www.school.edu/students/facebook/";) > > > br.select_form(nr = 1) > > > > br.

Re: Download unnamed web image?

2010-02-16 Thread galileo228
On Feb 16, 8:48 pm, John Bokma wrote: > galileo228 writes: > > Using BeautifulSoup, mechanize, and urllib, I've constructed the > > following: > > > br.open("http://www.school.edu/students/facebook/";) > > br.select_form(nr = 1) > > > br.form['fulltextsearch'] = 'msb83' # this searches the facebo

Re: Shipping Executables

2010-02-16 Thread Steven D'Aprano
On Tue, 16 Feb 2010 13:41:21 -0800, rodmc wrote: > Hi, > > I have been merrily programming away in Python now for a few years and > have a couple of applications I would like to possibly publish at some > point - with the exception of certain libraries they are more or less > 100% Python. However

Re: Hubris connects Ruby to Haskell, will there be such a connection between Python and Haskell?

2010-02-16 Thread Carl Banks
On Feb 16, 10:32 am, Casey Hawthorne wrote: > Hubris connects Ruby to Haskell, will there be such a connection > between Python and Haskell? I would have expected Hubris to link Ada and Common Lisp together. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Download unnamed web image?

2010-02-16 Thread John Bokma
galileo228 writes: > Using BeautifulSoup, mechanize, and urllib, I've constructed the > following: > > br.open("http://www.school.edu/students/facebook/";) > br.select_form(nr = 1) > > br.form['fulltextsearch'] = 'msb83' # this searches the facebook for > me > br.submit() > results = br.response(

Re: How to efficiently extract information from structured text file

2010-02-16 Thread Gary Herron
Imaginationworks wrote: Hi, I am trying to read object information from a text file (approx. 30,000 lines) with the following format, each line corresponds to a line in the text file. Currently, the whole file was read into a string list using readlines(), then use for loop to search the "= {"

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-16 Thread Aahz
In article <8ca440b2-6094-4b35-80c5-81d000517...@v20g2000prb.googlegroups.com>, Jonathan Gardner wrote: > >I used to think anonymous functions (AKA blocks, etc...) would be a >nice feature for Python. > >Then I looked at a stack trace from a different programming language >with lots of anonymous

Download unnamed web image?

2010-02-16 Thread galileo228
All, My python program signs onto the student facebook at my school and, given email addresses, returns the associated full name. If I were to do this through a regular browser, there is also a picture of the individual, and I am trying to get my program to download the picture as well. The probl

Re: How to efficiently extract information from structured text file

2010-02-16 Thread Rhodri James
On Tue, 16 Feb 2010 23:48:17 -, Imaginationworks wrote: Hi, I am trying to read object information from a text file (approx. 30,000 lines) with the following format, each line corresponds to a line in the text file. Currently, the whole file was read into a string list using readlines()

Wrap and intercept function calls

2010-02-16 Thread Dan Yamins
Hi: I'm wondering what the best way to wrap and modify function calls is. Essentially what I want to achieve is to have a function like this: def Wrap(frame,event,arg): if event == 'call': result = PerformCheck(GetArgumentsFromFrame(frame)) if Condition(result): r

Re: Shipping Executables

2010-02-16 Thread Philip Semanchuk
On Feb 16, 2010, at 4:41 PM, rodmc wrote: Hi, I have been merrily programming away in Python now for a few years and have a couple of applications I would like to possibly publish at some point - with the exception of certain libraries they are more or less 100% Python. However I have read els

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-16 Thread Jonathan Gardner
On Feb 16, 11:41 am, Andrej Mitrovic wrote: > On Feb 16, 7:38 pm, Casey Hawthorne > wrote: > > > Interesting talk on Python vs. Ruby and how he would like Python to > > have just a bit more syntactic flexibility. > > >http://blog.extracheese.org/2010/02/python-vs-ruby-a-battle-to-the-de... > > --

Re: Parsing for email addresses

2010-02-16 Thread galileo228
Tim - Thanks for this. I actually did intend to have to sift through other junk in the file, but then figured I could just cut and paste emails directly from the 'to' field, thus making life easier. Also, in this particular instance, the domain names were the same, and thus I was able to figure

How to efficiently extract information from structured text file

2010-02-16 Thread Imaginationworks
Hi, I am trying to read object information from a text file (approx. 30,000 lines) with the following format, each line corresponds to a line in the text file. Currently, the whole file was read into a string list using readlines(), then use for loop to search the "= {" and "};" to determine the

Re: listing existing windows services with python

2010-02-16 Thread David Bolen
alex23 writes: > News123 wrote: >> What is the best way with python to get a list of all windows services. >> >> As a start I would be glad to receive only the service names. >> >> However it would be nicer if I could get all the properties of a service >> as well. > > I highly recommend Tim Gol

ANN: obfuscate 0.2.2b

2010-02-16 Thread Steven D'Aprano
I am pleased to announce the beta release of obfuscate 0.2.2b. http://pypi.python.org/pypi/obfuscate/ The beta release does not contain any new functionality from the previous version, but includes bug fixes and many new tests. obfuscate is a pure-Python module providing classical encryption

Re: GIL state during import

2010-02-16 Thread Terry Reedy
On 2/16/2010 4:37 PM, Doron Tal wrote: Is the GIL released during import statement execution when accessing the file? If not, is it a bug? If it is not a bug, or it is here to stay for any other reason, I think it should be mentioned in the documentation. The CPython GIL is a CPython implementa

Re: The future of "frozen" types as the number of CPU cores increases

2010-02-16 Thread Terry Reedy
On 2/16/2010 3:15 PM, John Nagle wrote: In the beginning, Python had some types which were "frozen", > and some which weren't. In the beginning, there was only one 'frozen' general purpose collection type, the tuple. And Guido resisted the suggestion that lists and tuple were mutable and froz

Re: Which mock library do you prefer?

2010-02-16 Thread Phlip
On Feb 16, 12:30 pm, Ben Finney wrote: > Lacrima writes: > > And I have already refused to write totally isolated tests, because it > > looks like a great waste of time. > > It only looks like that until you chase your tail in a long, fruitless > debugging session because (you later realise) the

Re: Shipping Executables

2010-02-16 Thread geremy condra
On Tue, Feb 16, 2010 at 4:41 PM, rodmc wrote: > Hi, > > I have been merrily programming away in Python now for a few years and > have a couple of applications I would like to possibly publish at some > point - with the exception of certain libraries they are more or less > 100% Python. However I h

Re: Is there a simple way to find the list index to the max value?

2010-02-16 Thread Arnaud Delobelle
a...@pythoncraft.com (Aahz) writes: > In article <4b7a91b1.6030...@lonetwin.net>, steve wrote: >>On 02/16/2010 05:49 PM, W. eWatson wrote: >>> >>> See Subject. a = [1,4,9,3]. Find max, 9, then index to it, 2. >> >>The most obvious would be a.index(max(a)). Is that what you wanted ? > > The disad

Re: shelve.open generates (22, 'Invalid argument') Os X 10.5 with Python 2.5

2010-02-16 Thread seth
On Feb 14, 1:21 pm, a...@pythoncraft.com (Aahz) wrote: > Nope -- any reason you can't change the filename? > -- Os X 10.5 did not recognized the dbm extension. But, I have been able to fix the problem (hope it helps somebody): At http://docs.python.org/library/shelve.html it says: "shelve.open(

Shipping Executables

2010-02-16 Thread rodmc
Hi, I have been merrily programming away in Python now for a few years and have a couple of applications I would like to possibly publish at some point - with the exception of certain libraries they are more or less 100% Python. However I have read elsewhere online that Python due to it's architec

GIL state during import

2010-02-16 Thread Doron Tal
Is the GIL released during import statement execution when accessing the file? If not, is it a bug? If it is not a bug, or it is here to stay for any other reason, I think it should be mentioned in the documentation. --doron -- http://mail.python.org/mailman/listinfo/python-list

Wrestling with the Py2exe Install, Win7, Py2.5

2010-02-16 Thread W. eWatson
I've finally decided to see if I could make an executable out of a py file. Win7. Py2.5. I brought down the install file and proceeded with the install. I got two warning messages. Forgot the first. The second said,"Could not set the key value." I again used OK. I think that was the only choice

Hubris connects Ruby to Haskell, will there be such a connection between Python and Haskell?

2010-02-16 Thread geremy condra
Ok, I'll admit- my hand hovered over the 'initiate flamewar' button for a moment before I figured out what you were actually asking. And I know I'm working on it, which probably means 8 or 9 others are as well. Geremy Condra -- http://mail.python.org/mailman/listinfo/python-list

A fix for pylab and TkAgg plotting in SAGE (Mac OS X)

2010-02-16 Thread Lou Pecora
A few weeks ago I posted a problem with Mac OS X with matplotlib in the SAGE distribution in which attempting to import pylab gave an error message which stated that there was an import error and the module _tkagg could not be found. The problem appears to be with matplotlib (I'm not clear abou

Re: shelve.open generates (22, 'Invalid argument') Os X 10.5 with Python 2.5

2010-02-16 Thread Ned Deily
In article <7a9d26a8-0a9f-4bf3-bf50-0ac5e337f...@r24g2000yqd.googlegroups.com>, seth wrote: > We have a code that creates a simple Python shelve database. We are > able to serialize objects and store them in the dbm file. This seem to > work the same on Windows XP Python 2.5, Ubuntu 9.1 with Pyt

Re: listing existing windows services with python

2010-02-16 Thread Alf P. Steinbach
* Steve Holden: Alf P. Steinbach wrote: [...] I'll do some further research to see what's going on there. Cheers, - Alf (is this off-topic for the group?) It's gone a lot further off than this without anyone complaining. I think your experiences to date should convince you that you can rely

Re: Parsing for email addresses

2010-02-16 Thread Tim Chase
galileo228 wrote: [code] fileHandle = open('/Users/Matt/Documents/python/results.txt','r') names = fileHandle.readlines() [/code] Now, the 'names' list has values looking like this: ['aa...@domain.com \n', 'bb...@domain.com\n', etc]. So I ran the following code: [code] for x in names: st_li

The future of "frozen" types as the number of CPU cores increases

2010-02-16 Thread John Nagle
In the beginning, Python had some types which were "frozen", and some which weren't. Now, there's a trend towards having both "frozen" and "unfrozen" versions of built-in types. We now have "frozen" and "unfrozen" sets, dictionaries, and byte arrays. It's becoming clear that that the concept

Re: Is there a simple way to find the list index to the max value?

2010-02-16 Thread Tim Golden
On 16/02/2010 19:44, Aahz wrote: In article<4b7a91b1.6030...@lonetwin.net>, steve wrote: On 02/16/2010 05:49 PM, W. eWatson wrote: See Subject. a = [1,4,9,3]. Find max, 9, then index to it, 2. The most obvious would be a.index(max(a)). Is that what you wanted ? The disadvantage of that is

Re: plugin / intra process communication system

2010-02-16 Thread Florian Ludwig
On Tue, 2010-02-16 at 16:14 +0100, Paul Kölle wrote: > Am 15.02.2010 23:12, schrieb Florian Ludwig: > > On Sun, 2010-02-14 at 18:47 +0100, Diez B. Roggisch wrote: > >> [...] > >> And then of course, this is not really needed. In Python, behavior > >> counts, not type-information. So you can get awa

Re: Is there a simple way to find the list index to the max value?

2010-02-16 Thread Aahz
In article <4b7a91b1.6030...@lonetwin.net>, steve wrote: >On 02/16/2010 05:49 PM, W. eWatson wrote: >> >> See Subject. a = [1,4,9,3]. Find max, 9, then index to it, 2. > >The most obvious would be a.index(max(a)). Is that what you wanted ? The disadvantage of that is that it's O(2N) instead of O

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-16 Thread Andrej Mitrovic
On Feb 16, 7:38 pm, Casey Hawthorne wrote: > Interesting talk on Python vs. Ruby and how he would like Python to > have just a bit more syntactic flexibility. > > http://blog.extracheese.org/2010/02/python-vs-ruby-a-battle-to-the-de... > -- > Regards, > Casey Gary's friend Geoffrey Grosenbach say

Re: Parsing for email addresses

2010-02-16 Thread galileo228
Hey all, thanks as always for the quick responses. I actually found a very simple way to do what I needed to do. In short, I needed to take an email which had a large number of addresses in the 'to' field, and place just the identifiers (everything to the left of @domain.com), in a python list. I

Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-16 Thread Casey Hawthorne
Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility. http://blog.extracheese.org/2010/02/python-vs-ruby-a-battle-to-the-death.html -- Regards, Casey -- http://mail.python.org/mailman/listinfo/python-list

Hubris connects Ruby to Haskell, will there be such a connection between Python and Haskell?

2010-02-16 Thread Casey Hawthorne
Hubris connects Ruby to Haskell, will there be such a connection between Python and Haskell? -- Regards, Casey -- http://mail.python.org/mailman/listinfo/python-list

Re: plugin / intra process communication system

2010-02-16 Thread Diez B. Roggisch
Am 15.02.10 23:12, schrieb Florian Ludwig: On Sun, 2010-02-14 at 18:47 +0100, Diez B. Roggisch wrote: Here there problem with the trac (and other plugin systems I've seen) approach: You need to define something like: | | class IAuthPlugin(Interface): [...] | in your blog software. Why? Any

Re: Which mock library do you prefer?

2010-02-16 Thread Phlip
On Feb 16, 9:08 am, Lacrima wrote: > Thanks for your exhaustive answer. > Actually, I'll investigate your example with 'frob'. From just reading > the example it's not clear for me what I will benefit, using this > approach. I can't get a good hit for "construction encapsulation" in Google. (Alt

Re: Which mock library do you prefer?

2010-02-16 Thread Lacrima
On Feb 15, 9:56 pm, Phlip wrote: > Lacrima wrote: > > Thanks for your reply! Isn't what you are talking about integration > > tests? And unit tests should be fully isolated? So even for method > > 'some_method()' of class A I should mock instance of class A (i.e. to > > mock 'self') to test 'some_

Re: Using class attributes

2010-02-16 Thread Terry Reedy
On 2/16/2010 8:56 AM, Leo Breebaart wrote: Chris Rebert writes: On Mon, Feb 15, 2010 at 10:29 AM, Leo Breebaart wrote: I have a base class Foo with a number of derived classes FooA, FooB, FooC, etc. Each of these derived classes needs to read (upon initialisation) text from an associated te

Re: Which mock library do you prefer?

2010-02-16 Thread Lacrima
On Feb 16, 2:17 am, Ben Finney wrote: > Lacrima writes: > > Minimock has wider usage and community, but I have some troubles using > > it. Maybe I am wrong, but with minimock you always have to keep track > > the order of imports in your test modules. Well, may be I just don't > > understand full

Re: how to structure a directory with many scripts and shared code

2010-02-16 Thread Benedict Verheyen
Jean-Michel Pichavant wrote: > Benedict Verheyen wrote: >> Hhhm, i can see how it makes the maintenance cleaner. >> However, in the case of a single setup.py, i will end up installing >> scripts on servers >> that will never use them, only some. >> > You should care about this only if your scr

Re: how to structure a directory with many scripts and shared code

2010-02-16 Thread Jean-Michel Pichavant
Benedict Verheyen wrote: sstein...@gmail.com wrote: On Feb 16, 2010, at 3:28 AM, Benedict Verheyen wrote: python_scripts | |-->trunk ..|-> my big script 1 |-> setup.py ..|-> my big script 2 |-> setup.py ..|-> database

Re: Updating Packages in 2.5 (win/numpy) and Related Matters

2010-02-16 Thread Robert Kern
On 2010-02-16 09:37 AM, W. eWatson wrote: On 2/16/2010 7:30 AM, Robert Kern wrote: On 2010-02-16 06:16 AM, W. eWatson wrote: I normally use IDLE on Win, but recently needed to go to command prompt to see all error messages. When I did, I was greeted by a host of deprecation and Numpy messages b

Re: how to structure a directory with many scripts and shared code

2010-02-16 Thread Benedict Verheyen
sstein...@gmail.com wrote: > On Feb 16, 2010, at 3:28 AM, Benedict Verheyen wrote: >> python_scripts >> | >> |-->trunk >> ..|-> my big script 1 >> |-> setup.py >> ..|-> my big script 2 >> |-> setup.py >> ..|-> database >> ...

Re: listing existing windows services with python

2010-02-16 Thread Steve Holden
Alf P. Steinbach wrote: [...] >> I'll do some further research to see what's going on there. > > Cheers, > > - Alf (is this off-topic for the group?) It's gone a lot further off than this without anyone complaining. I think your experiences to date should convince you that you can rely on being

Re: Python Optimization

2010-02-16 Thread Paul Boddie
On 14 Feb, 19:41, Steve Howell wrote: > > I ditto the profiling recommendation. > > http://docs.python.org/library/profile.html (To the original inquirer...) Try this, too: http://wiki.python.org/moin/PythonSpeed/Profiling If you have the tools, it's a lot easier than scanning through tables of

Re: Updating Packages in 2.5 (win/numpy) and Related Matters

2010-02-16 Thread W. eWatson
On 2/16/2010 7:30 AM, Robert Kern wrote: On 2010-02-16 06:16 AM, W. eWatson wrote: I normally use IDLE on Win, but recently needed to go to command prompt to see all error messages. When I did, I was greeted by a host of deprecation and Numpy messages before things got running. The program other

Re: listing existing windows services with python

2010-02-16 Thread sstein...@gmail.com
On Feb 16, 2010, at 4:04 AM, Ben Finney wrote: > Please, don't send the above kind of vitriol to this public forum. > Better yet, compose it in your editor, bask in what you've written, then > delete it unsent. +1 If you kids want to have some sort of pissing-in-your-sockpuppet type of contest

Re: Is there a simple way to find the list index to the max value?

2010-02-16 Thread W. eWatson
On 2/16/2010 4:41 AM, Arnaud Delobelle wrote: Arnaud Delobelle writes: "W. eWatson" writes: See Subject. a = [1,4,9,3]. Find max, 9, then index to it, 2. Here are a few ways. [...] My copy past went wrond and I forgot the first one: a = [1,4,9,3] max_index = a.index(max(a)) max_index

Re: Updating Packages in 2.5 (win/numpy) and Related Matters

2010-02-16 Thread Robert Kern
On 2010-02-16 06:16 AM, W. eWatson wrote: I normally use IDLE on Win, but recently needed to go to command prompt to see all error messages. When I did, I was greeted by a host of deprecation and Numpy messages before things got running. The program otherwise functioned OK, after I found the prob

Re: Using class attributes

2010-02-16 Thread Arnaud Delobelle
Jean-Michel Pichavant writes: [...] > While all these proposals are giving interesting technical anwsers to > the OP problem, I think that the OP original code is still the best > (_imo_). > > class Foo(object): > def __init__(self): > self.template_filename = "%s.tmpl" % self.__cla

Re: Implicit __init__ execution in multiple inheritance

2010-02-16 Thread Bruno Desthuilliers
Arnaud Delobelle a écrit : rludwinowski writes: class A: def __init__(self): print("A__init__") class B: def __init__(self): print("B__init__") class C(A, B): pass C() A__init__ Why __init__ class B will not be automatic executed? Because it's documented beh

Re: plugin / intra process communication system

2010-02-16 Thread Paul Kölle
Am 15.02.2010 23:12, schrieb Florian Ludwig: On Sun, 2010-02-14 at 18:47 +0100, Diez B. Roggisch wrote: [...] And then of course, this is not really needed. In Python, behavior counts, not type-information. So you can get away without any explicit declared interface. You might chose to not do t

Re: Using class attributes

2010-02-16 Thread Jean-Michel Pichavant
Arnaud Delobelle wrote: Leo Breebaart writes: Chris Rebert writes: On Mon, Feb 15, 2010 at 10:29 AM, Leo Breebaart wrote: I have a base class Foo with a number of derived classes FooA, FooB, FooC, etc. Each of these derived classes needs to read (upon initialisation) text

Re: how to structure a directory with many scripts and shared code

2010-02-16 Thread sstein...@gmail.com
On Feb 16, 2010, at 3:28 AM, Benedict Verheyen wrote: > Steven D'Aprano wrote: >> On Mon, 15 Feb 2010 16:29:05 +0100, Benedict Verheyen wrote: >> >>> However, when i make a subdirectory, for example database and put a >>> script in there, how would i import logutils or mailtutils from within >>>

Re: Implicit __init__ execution in multiple inheritance

2010-02-16 Thread Arnaud Delobelle
rludwinowski writes: > class A: > def __init__(self): > print("A__init__") > > class B: > def __init__(self): > print("B__init__") > > class C(A, B): > pass > > C() > >>> A__init__ > > Why __init__ class B will not be automatic executed? Because it's documented behavi

Re: Using class attributes

2010-02-16 Thread Arnaud Delobelle
Leo Breebaart writes: > Chris Rebert writes: > >> On Mon, Feb 15, 2010 at 10:29 AM, Leo Breebaart wrote: >> >> > I have a base class Foo with a number of derived classes FooA, >> > FooB, FooC, etc. Each of these derived classes needs to read >> > (upon initialisation) text from an associated te

Implicit __init__ execution in multiple inheritance

2010-02-16 Thread rludwinowski
class A: def __init__(self): print("A__init__") class B: def __init__(self): print("B__init__") class C(A, B): pass C() >> A__init__ Why __init__ class B will not be automatic executed? -- http://mail.python.org/mailman/listinfo/python-list

Re: listing existing windows services with python

2010-02-16 Thread Martin P. Hellwig
On 02/16/10 13:51, Alf P. Steinbach wrote: - Alf (is this off-topic for the group?) Strictly speaking yes, but I do find it interesting and there is nothing wrong with ignoring posts you don't like to read. -- mph -- http://mail.python.org/mailman/listinfo/python-list

Re: Using class attributes

2010-02-16 Thread Leo Breebaart
Chris Rebert writes: > On Mon, Feb 15, 2010 at 10:29 AM, Leo Breebaart wrote: > > > I have a base class Foo with a number of derived classes FooA, > > FooB, FooC, etc. Each of these derived classes needs to read > > (upon initialisation) text from an associated template file > > FooA.tmpl, FooB.

Re: listing existing windows services with python

2010-02-16 Thread Alf P. Steinbach
* Tim Golden: On 16/02/2010 12:48, Alf P. Steinbach wrote: I just googled the filename from memory, found http://www.neuber.com/taskmanager/process/wmiprvse.exe.html> Don't know if I've disabled it because invoking wmic didn't produce it. Uh, wait, since it hosts the provider service(s),

Re: listing existing windows services with python

2010-02-16 Thread Tim Golden
On 16/02/2010 12:48, Alf P. Steinbach wrote: I just googled the filename from memory, found http://www.neuber.com/taskmanager/process/wmiprvse.exe.html> Don't know if I've disabled it because invoking wmic didn't produce it. Uh, wait, since it hosts the provider service(s), perhaps... Yes

Re: listing existing windows services with python

2010-02-16 Thread Alf P. Steinbach
* Tim Golden: On 16/02/2010 12:18, News123 wrote: I don't use the script often, so if it would start a WMI service during runtime and stop it afterwards it would be fine. FWIW -- your other considerations notwithstanding -- I'm not aware of WMI having this effect. Generally you can assume that

Re: Is there a simple way to find the list index to the max value?

2010-02-16 Thread Arnaud Delobelle
Arnaud Delobelle writes: > "W. eWatson" writes: > >> See Subject. a = [1,4,9,3]. Find max, 9, then index to it, 2. > > Here are a few ways. [...] My copy past went wrond and I forgot the first one: >>> a = [1,4,9,3] >>> max_index = a.index(max(a)) >>> max_index 2 -- Arnaud -- http://mail.p

Re: Is there a simple way to find the list index to the max value?

2010-02-16 Thread steve
On 02/16/2010 05:49 PM, W. eWatson wrote: See Subject. a = [1,4,9,3]. Find max, 9, then index to it, 2. The most obvious would be a.index(max(a)). Is that what you wanted ? cheers, - steve -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there a simple way to find the list index to the max value?

2010-02-16 Thread Arnaud Delobelle
"W. eWatson" writes: > See Subject. a = [1,4,9,3]. Find max, 9, then index to it, 2. Here are a few ways. >>> a = [1,4,9,3] >>> max_index = max(xrange(len(a)), key=a.__getitem__) >>> max_index 2 >>> # Or: ... max_index = max((n, i) for i, n in enumerate(a))[1] >>> max_index 2 >>> # Or: ... from

Re: listing existing windows services with python

2010-02-16 Thread Tim Golden
On 16/02/2010 12:18, News123 wrote: I don't use the script often, so if it would start a WMI service during runtime and stop it afterwards it would be fine. FWIW -- your other considerations notwithstanding -- I'm not aware of WMI having this effect. Generally you can assume that the WMI servic

Re: finding contents from string

2010-02-16 Thread Praveen Boppana
It looks like you want to extract the query parameters from standard url's. There is a standard Python module to accomplish this: http://www.python.org/doc/2.5.2/lib/module-urlparse.html From: danin To: python-list@python.org Sent: Tue, 16 February, 2010 4:13:

Re: listing existing windows services with python

2010-02-16 Thread News123
Thanks for your answers, The security wouldn't be a concern, as I would run while being only accessible by trusted hosts. I don't use the script often, so if it would start a WMI service during runtime and stop it afterwards it would be fine. I just wonder whether installing another 3rd party

Updating Packages in 2.5 (win/numpy) and Related Matters

2010-02-16 Thread W. eWatson
I normally use IDLE on Win, but recently needed to go to command prompt to see all error messages. When I did, I was greeted by a host of deprecation and Numpy messages before things got running. The program otherwise functioned OK, after I found the problem I was after. Are these messages a wa

Re: finding contents from string

2010-02-16 Thread Lars Behrens
danin wrote: > can anyone please tell me about how to do this. Now come on, you have to give a *bit* more information. What have you done so far? What did you plan? What are the rules for finding the string? -- Cheerz Lars -- http://mail.python.org/mailman/listinfo/python-list

Re: Few Small Questions Regarding CGI

2010-02-16 Thread Lawrence D'Oliveiro
In message <631b0785-38db-4c12- a82a-7b11e2235...@o16g2000prh.googlegroups.com>, joy99 wrote: > Is there any other material or URL for step by step learning of CGI. There’s the official spec here . -- http://mail.python.org/mailman/listinfo/py

Re: finding contents from string

2010-02-16 Thread Peter Otten
danin wrote: > Hi all, > I am looking for particular solution. I am having one string > say: > string- "http://maps.google.co.in/maps/ms? > hl=en&ie=UTF8&msa=0&msid=106178526636832397420.00047fb46fa8d02481f09&ll=20.730428,86.456909&spn=2.178194,3.526611&z=8 > " > and from this s

Re: finding contents from string

2010-02-16 Thread Arnaud Delobelle
danin writes: > Hi all, > I am looking for particular solution. I am having one string > say: > string- "http://maps.google.co.in/maps/ms? > hl=en&ie=UTF8&msa=0&msid=106178526636832397420.00047fb46fa8d02481f09&ll=20.730428,86.456909&spn=2.178194,3.526611&z=8 > " > and from this

finding contents from string

2010-02-16 Thread danin
Hi all, I am looking for particular solution. I am having one string say: string- "http://maps.google.co.in/maps/ms? hl=en&ie=UTF8&msa=0&msid=106178526636832397420.00047fb46fa8d02481f09&ll=20.730428,86.456909&spn=2.178194,3.526611&z=8 " and from this string i need to extract valu

Re: listing existing windows services with python

2010-02-16 Thread Ben Finney
alex23 writes: > Yes, because that's _actually helping people_ and not just > contributing the usual self-serving pontificating nonsense that just > _flows_ from your goddamn mouth like a river of effluent psuedotruths. I can't see what improvement you hope to achieve by sending something like t

Re: Union of class variables

2010-02-16 Thread Ben Finney
Joan Miller writes: > Is possible to get a third class with the class variables of another > two classes? Multiple inheritance is allowed in Python: class Baz(Foo, Bar): pass However, it leads to complications that you likely don't want, e.g. http://www.artima.com/weblogs/viewpost.

Re: Union of class variables [Solved]

2010-02-16 Thread Joan Miller
On 16 feb, 08:40, alex23 wrote: > On Feb 16, 6:16 pm, Joan Miller wrote: > > > Is possible to get a third class with the class variables of another > > two classes? > > > > > class A: > >     foo = 1 > > > class B: > >     bar = 2 > > > > Through multiple inheritance? > >   >>>

Re: Printing with raw_input

2010-02-16 Thread Peter Otten
Shashwat Anand wrote: > raw_input uses sys.stderr I guess ? I had a look at the C code, but it's a bit confusing. If I'm reading it correctly the prompt is written to the "real" stderr if and only if sys.stdin and sys.stdout are attached to a terminal. $ python -c"raw_input('prompt\n')" 2>tmp.

Re: listing existing windows services with python

2010-02-16 Thread Alf P. Steinbach
* alex23: "Alf P. Steinbach" wrote: it's great that you provide the kind of help that you did, pointing out a probably very good module that it seems gives the required functionality, and giving an URL. Yes, because that's _actually helping people_ and not just contributing the usual self-ser

Re: Union of class variables

2010-02-16 Thread alex23
On Feb 16, 6:16 pm, Joan Miller wrote: > Is possible to get a third class with the class variables of another > two classes? > > > class A: >     foo = 1 > > class B: >     bar = 2 > Through multiple inheritance? >>> class C(A, B): ... pass ... >>> C.foo 1 >>> C.b

Re: listing existing windows services with python

2010-02-16 Thread alex23
"Alf P. Steinbach" wrote: > it's great that you provide the kind > of help that you did, pointing out a probably very good module that it seems > gives the required functionality, and giving an URL. Yes, because that's _actually helping people_ and not just contributing the usual self-serving pon

  1   2   >