It is usually clearer to explicitely return values that are changed by
a function and re-assign it to the same variable,
x=something1
a = something2
def f1(s,t):
# do something with t,
# do something to s
return s
a = f1(a,x)
Be aware however that you can wrap 'a' in a list for the same eff
?
--
http://mail.python.org/mailman/listinfo/python-list
I was playing with lambdas and list compregensions and came
across this unexpected behaviour:
>>> adds = [lambda y: (y + n) for n in range(10)]
>>> adds[0](0)
9
>>> for n in range(5): print adds[n](42)
...
42
43
44
45
46
>>> adds[0](0)
4
Can anyone explain the different answers I'm getting?
FWIW
On Sun, 27 Feb 2005 09:07:28 + (UTC), Alan Gauld
<[EMAIL PROTECTED]> wrote:
> >>> adds = [lambda y: (y + n) for n in range(10)]
> >>> adds[0](0)
> 9
> >>> for n in range(5): print adds[n](42)
> ...
> 42
> 43
> the for loop... It seems to somehow be related to the
> last value in the range(),
Hi - I've got a script which is making use of ...
import wx.lib.iewinas iewin
... and so ...
self.ie = iewin.IEHtmlWindow(self, -1, style =
wx.NO_FULL_REPAINT_ON_RESIZE)
... but I can't find any documentation about what a IEHtmlWindow
object might do - in particular what I might do with t
Which XSLT processor is the most reliable?
requirement:
+ must support Python 2.4
+ must run w/ Windows (and Linux)
+ not super slow
My python project needs a XSLT processor + Docbook's XSLT to translate
from docbook-xml -> HTML.
PyXML? is it reliable? Slow?
4Suite? some said it is buggy (lots of
Hello NG,
I am trying to find some information about the possibility to control
two (or more) clients (PCs) via a Python application running on a main server.
Ideally, this application should be able to monitor (almost in real time)
the "activity" of these clients (which applications are l
Alan Gauld wrote:
> I was playing with lambdas and list compregensions and came
> across this unexpected behaviour:
>
>
adds = [lambda y: (y + n) for n in range(10)]
adds[0](0)
>
> 9
>
for n in range(5): print adds[n](42)
>
> ...
> 42
> 43
> 44
> 45
> 46
>
adds[0](0)
>
> 4
>
In article <[EMAIL PROTECTED]>,
"Carl Banks" <[EMAIL PROTECTED]> wrote:
> Just wrote:
> > While googling for a non-linear equation solver, I found
> > Math::Polynomial::Solve in CPAN. It seems a great little module,
> except
> > it's not Python... I'm especially looking for its poly_root()
> > fu
John Machin wrote:
I've tested it intensively
"Famous Last Words" :-)
;-)
(1) Manic s/w producing lots of files all the same size: the Borland
C[++] compiler produces a debug symbol file (.tds) that's always
384KB; I have 144 of these on my HD, rarely more than 1 in the same
directory.
Not sure wha
Hi,
I was wondering if anyone has had any luck with the python text to speech
(pyTTS) module available on Sourceforge:
http://sourceforge.net/projects/uncassist
I have followed the tutorial for pyTTS at:
http://www.cs.unc.edu/~parente/tech/tr02.shtml
Using the first simple speech example:
import
Grant Edwards <[EMAIL PROTECTED]> wrote:
> First, make it work. Then make it work right. Then worry
> about how fast it is.
> "Premature optimization..."
That could be - but then again, most of the comments I've seen for that
particular issue are for rather old releases.
>> It seems to use a
Hi folks,
Has anyone seen 'Googlewhack Adventure'?
http://www.davegorman.com/googlewhack.htm
I wrote a script to generate Googlewhacks - thought I'd share it with
you. I'd better stop running it as I fear Google may ban my IP for
making 20 searches a seconds..
Will McGugan
import random
import u
Will McGugan wrote:
Hi folks,
Has anyone seen 'Googlewhack Adventure'?
http://www.davegorman.com/googlewhack.htm
I wrote a script to generate Googlewhacks - thought I'd share it with
you. I'd better stop running it as I fear Google may ban my IP for
making 20 searches a seconds..
Oops, wrong scri
Jimmy Retzlaff wrote:
Anthonyberet wrote:
Is there a string mething to return only the alpha characters of a
string?
eg 'The Beatles - help - 03 - Ticket to ride', would be
'TheBeatlesTickettoride'
If not then how best to approach this?
I have some complicated plan to cut the string into individual
Thank you for your reply, Jhon.
It was useful advice.
> Take a hint: they say "Google is your friend", but better still is
the
> source in lib\*.py -- it's quite legible, you don't need an Internet
> connection, and there sure ain't no ads in the margin. And don't just
> open it in emergencies: pi
[EMAIL PROTECTED] said the following on 2/27/2005 4:44 AM:
Hello NG,
I am trying to find some information about the possibility to control
two (or more) clients (PCs) via a Python application running on a main server.
Ideally, this application should be able to monitor (almost in real time)
Hello Kartic & NG,
Thank you for your prompt answer. In effect, I'm trying to work on
a NT network of 6 PC (plus the server). Sorry to not have been clearer.
Ideally, I'm trying to monitor the Internet activity of each client (PC)
on this network (but I'm not a boss trying to control my emply
[EMAIL PROTECTED] said the following on 2/27/2005 8:40 AM:
Hello Kartic & NG,
Thank you for your prompt answer. In effect, I'm trying to work on
a NT network of 6 PC (plus the server). Sorry to not have been clearer.
Ideally, I'm trying to monitor the Internet activity of each client (PC)
on t
[EMAIL PROTECTED] a écrit :
Hello Kartic & NG,
Thank you for your prompt answer. In effect, I'm trying to work on
a NT network of 6 PC (plus the server). Sorry to not have been clearer.
Ideally, I'm trying to monitor the Internet activity of each client (PC)
on this network (but I'm not a boss
Kartic said the following on 2/27/2005 8:54 AM:
For a homegrown solution, if I am not mistaken, you will have to use
libpcap (or pypcap) to monitor the packets being sent and received,
taking care to exclude the local subnet (or your reporting will be
skewed as packets sent to the monitoring ser
Gary Ruben wrote:
I have a class factory problem. You could say that my main problem is
that I don't understand class factories.
My specific problem:
I have a class with several methods I've defined.
To this class I want to add a number of other class methods where the
method names are taken from a
[EMAIL PROTECTED] a écrit:
> I'm trying to install wxPython 2.5.3.1 using Python 2.3.2 on a Fedora 2
> machine.
>
> I have python in a non-standard place, but I'm using --prefix with the
> configure script to point to where I have everything. The make install
> in $WXDIR seemed to go fine. I have
Hey,
I've spent far too long being spoilt by a relatively simplistic "just do
it" style of database application in use at work and have decided to try
my hand at some Python + MySQL + GTK over the next few days.
I've managed to steal/write a short script that asks for some input and
searches a
I am trying to use the geometry() method with the toplevel window
called root. I know that one can do the following:
root.geometry('400x400+200+200')
This will put the window in 200, 200 position with a size of 400x400.
Now, I don't really want to set the size. I simply want to set the
position o
They actually won't ban your IP for this. They only limit your number
of searches per day. I discovered this once when I used
http://www.google.com as a test metric for my network monitoring
program. I do like your script though.
Regards,
Harlin
--
http://mail.python.org/mailman/listinfo/python
Hello
There are several different objects. However, they all share the same
function.
Since they are not the same or similar, it's not logical to use a
common superclass.
So I'm asking, what's a good way to allow those objects to share that
function?
The best solution I've found so far is to pu
Alan Gauld wrote:
> On Sun, 27 Feb 2005 09:07:28 + (UTC), Alan Gauld
> <[EMAIL PROTECTED]> wrote:
>
>
>adds = [lambda y: (y + n) for n in range(10)]
>adds[0](0)
>>
>>9
>>
>for n in range(5): print adds[n](42)
>>
>>...
>>42
>>43
>
>
>>the for loop... It seems to somehow be relate
[EMAIL PROTECTED] wrote:
def mockit(): raise StopIteration
now pass mockit()
but it behaviors differenctly when pass in a mockit() and pass in an
iterator with empty. so i think the code emulates nothing.
Is it possible that what you really need is a generator function
instead of just a regular
Just wrote:
In article <[EMAIL PROTECTED]>,
"Carl Banks" <[EMAIL PROTECTED]> wrote:
It should be pretty easy to set up a Numeric matrix and call
LinearAlgebra.eigenvalues. For example, here is a simple quintic
solver:
. from Numeric import *
. from LinearAlgebra import *
.
. def quinticroots(p):
Calvin Spealman wrote:
I'm trying to find the best way to use PyUnit and organize my test scripts.
What I really want is to separate all my tests into 'test' directories
within each module of my project.
The script below will do that.
I want all the files there to define a
'suite' callable and to
> Since they are not the same or similar, it's not logical to use a
> common superclass.
As python supports multiple inheritance, it's very well "logical" to do it
by subclassing.
>
> So I'm asking, what's a good way to allow those objects to share that
> function?
>
> The best solution I've fo
Mike P. wrote:
I was wondering if anyone has had any luck with the python text to speech
(pyTTS) module available on Sourceforge:
http://sourceforge.net/projects/uncassist
I saw the following blog entry by Joey deVilla:
http://farm.tucows.com/blog/Platforms/Windows/_archives/2005/1/19/266813.html
a
Alex Renelt wrote:
in addition:
I'm writing a class for polynomial manipulation. The generalization of
the above code is:
definitions:
1.) p = array([a_0, a_i, ..., a_n]) represents your polynomial
P(x) = \sum _{i=0} ^n a_i x^i
2.) deg(p) is its degree
3.) monic(p) makes P monic, i.e. monic(p) =
So, is it pronounced 'Tee-Kinter', or 'Tee-Kay-Inter'?
I don't want to appear as a dork down the pub.
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
I am running the line of code below from a shell script and it works fine,
however I am at a total loss on how i can run it from within a Python
script as every option I have tried fails and it appears to be down to the
escaping of certain characters.
wget -q www.anywebpage.com -O - | tr '\r'
Dear list,
My program needs to do calculation based on a giving data structure
(like a sparse matrix) with lots of missing values (invalid
indices/keys of lists/dictionaries).
The programing is difficult in that I have to use a try...except block
for every item access. I have written a functio
Peter Hansen wrote:
Mike P. wrote:
I was wondering if anyone has had any luck with the python text to speech
(pyTTS) module available on Sourceforge:
http://sourceforge.net/projects/uncassist
I saw the following blog entry by Joey deVilla:
http://farm.tucows.com/blog/Platforms/Windows/_archives/20
Rigga wrote:
> Hi,
>
> I am running the line of code below from a shell script and it works fine,
> however I am at a total loss on how i can run it from within a Python
> script as every option I have tried fails and it appears to be down to the
> escaping of certain characters.
>
> wget -q www
Alex Renelt wrote:
Alex Renelt wrote:
in addition:
I'm writing a class for polynomial manipulation. The generalization of
the above code is:
definitions:
1.) p = array([a_0, a_i, ..., a_n]) represents your polynomial
P(x) = \sum _{i=0} ^n a_i x^i
2.) deg(p) is its degree
3.) monic(p) makes P moni
anthonyberet wrote:
So, is it pronounced 'Tee-Kinter', or 'Tee-Kay-Inter'?
I don't want to appear as a dork down the pub.
Both, in my experience.
And then there's wxPython, which is pronounced variously
as "wiks-python", "double-you-eks-python", or even in some
strange way that I'll leave it to Mik
Pink wrote:
> Rigga wrote:
>
>> Hi,
>>
>> I am running the line of code below from a shell script and it works
>> fine, however I am at a total loss on how i can run it from within a
>> Python script as every option I have tried fails and it appears to be
>> down to the escaping of certain chara
On 2005-02-26, Just <[EMAIL PROTECTED]> wrote:
> While googling for a non-linear equation solver, I found
> Math::Polynomial::Solve in CPAN. It seems a great little module, except
> it's not Python... I'm especially looking for its poly_root()
> functionality (which solves arbitrary polynomials)
Hello,
what is a good python library for parsing of RSS and/or Atom feeds. It
should be able to handle most of the common protocols.
Thanks,
Florian
--
http://mail.python.org/mailman/listinfo/python-list
I'm using wget from Python to get extactly one line from a reports page.
I made this function that works for me:
def wgetline(exp): # see Python Cookbook p. 228
print "Getting result from server ..."
command = 'wget -q -O - \
http://www.foobar.com/report.pl\?UserID=xxx\&UserPW=xxx
Hi.
Has anyone used pyallegro? - I want to give allegro library a chance -
but it seems that python bindings for this library are not maintained
anymore.
How does pygame compare to pyallegro - both in maturity and convenience
of usage in python?
--
http://mail.python.org/mailman/listinfo/python-
Thanks all.
I will look at your links tonight :D
Hopefully they will make me smile and jump around as a happy man...
Cheers
"Brian Sutherland" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Sat, Feb 26, 2005 at 01:57:20PM +0100, Pete. wrote:
>> I'm trying to make a calend
Rigga wrote:
> Pink wrote:
>
>> Rigga wrote:
>>
>>> Hi,
>>>
>>> I am running the line of code below from a shell script and it works
>>> fine, however I am at a total loss on how i can run it from within a
>>> Python script as every option I have tried fails and it appears to be
>>> down to the
Carl Banks wrote:
> . from Numeric import *
> . from LinearAlgebra import *
> .
> . def quinticroots(p):
> . cm = zeros((5,5),Float32)
> . cm[0,1] = cm[1,2] = cm[2,3] = cm[3,4] = 1.0
> . cm[4,0] = -p[0]
> . cm[4,1] = -p[1]
> . cm[4,2] = -p[2]
> . cm[4,3] = -p[3]
> . cm[
Florian Lindner napisał(a):
what is a good python library for parsing of RSS and/or Atom feeds. It
should be able to handle most of the common protocols.
Mark Pilgrim's feedparser.
--
Jarek Zgoda
http://jpa.berlios.de/ | http://www.zgodowie.org/
--
http://mail.python.org/mailman/listinfo/python-lis
Tim Jarman wrote:
> Rigga wrote:
>
>> Pink wrote:
>>
>>> Rigga wrote:
>>>
Hi,
I am running the line of code below from a shell script and it works
fine, however I am at a total loss on how i can run it from within a
Python script as every option I have tried fails and
To clearify the problem:
The data is the count of something, for example a[90]=10. a may be a
dictionary if the range is huge and a list when the range is reasonably
small. In the dictionary case, I can use a.setdefault(80, 0) if key 80
does not exist. In the list case, I have to check the lengt
Rigga said unto the world upon 2005-02-27 15:04:
Tim Jarman wrote:
No, the r was the point - it's there to tell Python not to do any escaping
on the string. Try it again with the r and see what happens.
Brilliant!!! that works a treat thankyou!!, where on earth did you find out
about the 'r' any
Rigga wrote:
>> No, the r was the point - it's there to tell Python not to do any
>> escaping on the string. Try it again with the r and see what happens.
>>
> Brilliant!!! that works a treat thankyou!!, where on earth did you find
> out
> about the 'r' any pointers to documentation appreciated.
Bo Peng wrote:
The data is the count of something, for example a[90]=10. a may be a
dictionary if the range is huge and a list when the range is reasonably
small. In the dictionary case, I can use a.setdefault(80, 0) if key 80
does not exist. In the list case, I have to check the length of list
Ð ÐÑÐ, 27/02/2005 Ð 14:03 -0600, Bo Peng ÐÐÑÐÑ:
> To clearify the problem:
>
> The data is the count of something, for example a[90]=10. a may be a
> dictionary if the range is huge and a list when the range is reasonably
> small. In the dictionary case, I can use a.setdefault(80, 0) if key 80
"Alan Gauld" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
adds = [lambda y: (y + n) for n in range(10)]
To bind the definition-time value of n to the function,
[lambda y,n=n:(y+n) for n in range(10)]
Terry J. Reedy
--
http://mail.python.org/mailman/listinfo/python-list
What does the above yield on Windows? Are inodes supported on Windows
NTFS, FAT, FAT32?
--
http://mail.python.org/mailman/listinfo/python-list
I suspect you need to retrieve the window size, calculate the position
based on the size, and reset size and position.
You might look at http://www.ferg.org/easygui/index.html for some
ideas. Scroll down to the definition of the __choicebox routine.
Good luck!
-- Steve Ferg
--
http://mail.pyt
<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>> def mockit(): raise StopIteration
This was meant to be a generator function. Peter corrected my error in
leaving out a never reached yield to make it so. My apologies. Putting if
False: yield None as the first line in the functi
Sounds to me like the best solution is to simplify the implementation
and dispense with the list alternative. Why use a list if a dictionary
is suitable? Don't say performance: that's premature optimization.
Dictionaries already have what you need, apparently, with setdefault(),
so just use them
On Sun, Feb 27, 2005 at 10:16:34PM +0100, Patrick Useldinger wrote:
> What does the above yield on Windows? Are inodes supported on Windows
> NTFS, FAT, FAT32?
Refer to the operating system documentation (msdn.microsoft.com?). os.stat is
mostly a wrapper around whatever the OS provides. A quic
I've written a little introductory article on using the Zeroconf protocol
with Python. Zeroconf allows servers running on one machine to publish
their existence to other machines on the local network; applications can
then locate available servers.
The article is:
http://www.amk.ca/python/ze
Steve Holden wrote:
I have no problem with that. Indeed I am often surprised that questions
that I regard as too incoherent to be understood are frequently not only
understood but also answered with patience and fortitude.
I am too.
Given that you couldn't spare the time to try to intuit the purp
[EMAIL PROTECTED] wrote:
> Refer to the operating system documentation (msdn.microsoft.com?).
os.stat is
mostly a wrapper around whatever the OS provides. A quick glance at Python
source code shows that maybe _stati64() or _wistat64() is the actual function
used on windows.
That doesn't really h
Hello all, I'm new to the group. I wanted to start off introducing
myself. I live in Maimi, Florida USa. I'm 18 currently working and
going to college for computer science.
I've been hearing about Python and I see that it is starting to catch
on so I decided I'm going to learn it. I know t
I thought the T was silent.
On Sunday 27 February 2005 08:34 am, anthonyberet wrote:
> So, is it pronounced 'Tee-Kinter', or 'Tee-Kay-Inter'?
> I don't want to appear as a dork down the pub.
--
http://mail.python.org/mailman/listinfo/python-list
> Would this be for a GUI toolkit or maybe using a standard
> class scheme?
Sorry, yes I should have been more specific. I meant a non-GUI, standard
class scheme. I want to use the scheme to hold a structure in memory and
retrieve/add information to it.
I've had a couple of goes myself but get a
Gee, no takers?
Here's a (surprise!) pyparsing solution.
-- Paul
.# get pyparsing at http://pyparsing.sourceforge.net
.
.from pyparsing import quotedString, printables, Word, OneOrMore,
Forward, Literal,delimitedList,Group
.quotedString.setParseAction(lambda s,l,t: t[0].strip("'\""))
.
.line1 =
Nick Coghlan wrote:
Jimmy Retzlaff wrote:
The approach you are considering may be easier than you think:
filter(str.isalpha, 'The Beatles - help - 03 - Ticket to ride')
'TheBeatleshelpTickettoride'
Hmm, I think this is a case where filter is significantly clearer than
the equivalent list comprehen
but someone got out and me and my familiy try to stop them and got
trocherd in unknow dimentions i try to make it better and they change
me to make it worse so what do i do if you see what in my chest in
every dimention!!! look for consiousnesses in the house i spelled it
wrong bbecuase thats what
> How does pygame compare to pyallegro - both in maturity and convenience
> of usage in python?
I have not used pyallegro, and therefore cannot compare it to pygame.
However, I can tell you that the pygame community is quite active and
friendly. They're currently testing the pygame 1.7 release.
"John Carter" <> wrote in message
news:[EMAIL PROTECTED]
> Does anyone know how to embed PIL into a py2exe program.
>
> As far as I can tell PIL is not finding its plugins for Image I/O,
> they are imported dynamically as required. So I cant load or save
> pictures
>
> I tried making a copy of the
Sure It can work with VB.
you could use the python's com to work with VB.
--
http://mail.python.org/mailman/listinfo/python-list
Is it useful to combine psyco with python -O, or do they conflict?
Thanks!
--
http://mail.python.org/mailman/listinfo/python-list
hi,
Can anybody help in closing tabs in wxpython.Pls give me a sample
program for explaining this.Thanx in advance
--
http://mail.python.org/mailman/listinfo/python-list
Damned cut-and-paste in GoogleGroups edit window (leading '.'s are to
retain spacing):
.# get pyparsing at http://pyparsing.sourceforge.net
.
.from pyparsing import quotedString, printables, Word, OneOrMore,
Forward, Literal,delimitedList,Group
.
.line1 = """path {{data/tom} C:/user/john}"""
.line
Does anyone know how I can access and read data
from a dbase (.dbf) file?
Regards,
Stan
--
http://mail.python.org/mailman/listinfo/python-list
Stan Cook <[EMAIL PROTECTED]> writes:
> Does anyone know how I can access and read data from a dbase (.dbf)
> file?
Yeah, there's some module around someplace that does it. I found it
with a few minutes of googling a while back. It worked fine. I don't
remember where it was.
--
http://mail.pyt
I have a grid. I want to sort it when a column label is clicked. I know
about the EVT_GRID_LABEL_LEFT_DCLICK event, but that is not enough. I
do not merely need to know that a label was clicked. I need to know
which label was clicked. I do not know how to do that. I suspect you
might know. I reques
Stan Cook wrote:
Does anyone know how I can access and read data from a dbase (.dbf) file?
I know nothing about them, but Raymond Hettinger recently posted a
recipe that I believe should help:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/362715
STeVe
--
http://mail.python.org/mailman/l
Alex Le Dain said unto the world upon 2005-02-27 19:54:
> Would this be for a GUI toolkit or maybe using a standard
> class scheme?
Sorry, yes I should have been more specific. I meant a non-GUI, standard
class scheme. I want to use the scheme to hold a structure in memory and
retrieve/add info
Gensek wrote:
I have a grid. I want to sort it when a column label is clicked. I know
about the EVT_GRID_LABEL_LEFT_DCLICK event, but that is not enough. I
do not merely need to know that a label was clicked. I need to know
which label was clicked. I do not know how to do that. I suspect you
might
83 matches
Mail list logo