On Sat, 23 Dec 2006 12:38:30 -0800, Fuzzyman wrote:
>
> Lars Rune Nøstdal wrote:
>> On Fri, 08 Dec 2006 03:07:09 -0800, Mark Tarver wrote:
>>
>> > How do you compare Python to Lisp? What specific advantages do you
>> > think that one has over the other?
>> >
>> > Note I'm not a Python person and
At Wednesday 27/12/2006 01:58, [EMAIL PROTECTED] wrote:
I could have sworn someone was working on a module recently with a
threading-like API that used subprocesses under the covers, but 10 minutes
or so of googling didn't yield anything. Pointers appreciated.
Perhaps this project?
I just wro
[EMAIL PROTECTED] wrote:
> I could have sworn someone was working on a module recently with a
> threading-like API that used subprocesses under the covers, but 10 minutes
> or so of googling didn't yield anything. Pointers appreciated.
http://www.python.org/dev/summary/2006-10-01_2006-10-15/#proc
I could have sworn someone was working on a module recently with a
threading-like API that used subprocesses under the covers, but 10 minutes
or so of googling didn't yield anything. Pointers appreciated.
Thx,
Skip
--
http://mail.python.org/mailman/listinfo/python-list
Hi.
One of the things I'd like to do with Python is find a way to
consistently implement Smalltalk's "loose methods". This is a
capability whereby additional methods can be added dynamically to
existing classes.
In some respects, it's possible with Python. While "object" cannot be
touched, it's
Osiris wrote:
> what is a usefull IDE for Python on Windows ?
The Zeus IDE: http://www.zeusedit.com/python.html
Jussi
--
http://mail.python.org/mailman/listinfo/python-list
WaterWalk wrote:
> WaterWalk wrote:
> > gonzlobo wrote:
> > > I've been using Python for a few days. It's such the perfect language
> > > for parsing data!
> > >
> > > I really like it so far, but I'm having a hard time reading a file,
> > > reading the first few hex characters & converting them t
WaterWalk wrote:
> gonzlobo wrote:
> > I've been using Python for a few days. It's such the perfect language
> > for parsing data!
> >
> > I really like it so far, but I'm having a hard time reading a file,
> > reading the first few hex characters & converting them to an integer.
> > Once the char
gonzlobo wrote:
> I've been using Python for a few days. It's such the perfect language
> for parsing data!
>
> I really like it so far, but I'm having a hard time reading a file,
> reading the first few hex characters & converting them to an integer.
> Once the characters are converted to an inte
Carl Banks wrote:
> [EMAIL PROTECTED] wrote:
> > After some trials I found that put "os.close(1)" before calling the
> > function will depress the output. In fact, "os.close(1)" closed
> > standard output, but I don't know how to open it again after the function's
> > execution.
>
> Try this:
>
>
[EMAIL PROTECTED] wrote:
> Hi,
>
> I'm writing a program which uses an external module written in C
> and calls a function provided by the module to do my job. The
> function produces a lot of output to the stdout.
>
> Is there a way to suppress the output produced by the function and
> hence
[EMAIL PROTECTED] wrote:
> After some trials I found that put "os.close(1)" before calling the
> function will depress the output. In fact, "os.close(1)" closed
> standard output, but I don't know how to open it again after the function's
> execution.
Try this:
fd = os.dup(1)
os.close(1)
sys.stdo
On Tue, 26 Dec 2006 16:50:06 -0700, gonzlobo wrote:
> I've been using Python for a few days. It's such the perfect language
> for parsing data!
>
> I really like it so far, but I'm having a hard time reading a file,
> reading the first few hex characters & converting them to an integer.
> Once th
gonzlobo wrote:
> I've been using Python for a few days. It's such the perfect language
> for parsing data!
>
> I really like it so far, but I'm having a hard time reading a file,
> reading the first few hex characters & converting them to an integer.
> Once the characters are converted to an inte
On Tue, 26 Dec 2006 15:01:40 -0800, buffi wrote:
>> def doStuff(some, arguments, may, *be, **required):
>> try:
>> doStuff.timesUsed += 1
>> except AttributeError:
>> doStuff.timesUsed = 1
>> # ... special case for first call ...
>> # ...common code...
>
On Tue, 26 Dec 2006 03:21:57 -0800, Luis Armendariz wrote:
> On Tuesday, 26.12.06 at 21:28, Steven D'Aprano wrote:
>>
>> # WARNING: untested
>> def run_without_stdout(*args, **kwargs):
>> function = args[0]
>> args = args[1:]
>> savestdout = sys.stdout
>> sys.stdout = cStringIO.St
I've been using Python for a few days. It's such the perfect language
for parsing data!
I really like it so far, but I'm having a hard time reading a file,
reading the first few hex characters & converting them to an integer.
Once the characters are converted to an integer, I'd like to write the
d
John Nagle wrote:
> Felipe Almeida Lessa wrote:
>
>> On 26 Dec 2006 04:22:38 -0800, placid <[EMAIL PROTECTED]> wrote:
>>
>>
>>> So do you want to remove "&" or replace them with "&" ? If you want
>>> to replace it try the following;
>>>
>> I think he wants to replace them, but just t
> Found out a quite fun way to store persistent variables in functions in
> python.
>
> Is this concidered bad coding practice since I guess persistent
> variables in functions are not meant to be?
I am using is in one of my recent projects. I was thinking of
it sort of like "static" variables
> I don't think so, since Python proudly says that functions are
> first-class objects.
> CherryPy does a similar thing to mark a method as "exposed".
>
> But perhaps I'd write the code this way to avoid an unneeded and
> risky recursive call:
>
> def doStuff(some, arguments, may, *be, **required):
Peter Machell wrote:
> Scott David Daniels wrote:
> > Peter Machell wrote:
> >> ZeD wrote:
> >>
> >> Thanks very much ZeD. This will do what I need to.
> >> The next step is to do some regex on the phone number to ensure it's
> >> local and correct. How can I split these up so each value has a key
At Tuesday 26/12/2006 19:13, buffi wrote:
def doStuff():
try:
#Will throw exception if not set
doStuff.timesUsed
Is this concidered bad coding practice since I guess persistent
variables in functions are not meant to be?
I don't think so, since Python proudly says that functions are
At Tuesday 26/12/2006 18:57, Peter Machell wrote:
for x in bar:
fname = x[0]
if fname == "":
fname == "None"
sname = x[1]
if sname == "":
sname == "None"
print ""+fname+""+""+sname+""
Except that
Peter Machell wrote:
> I can almost do it this way:
>
> for x in bar:
> fname = x[0]
> if fname == "":
> fname == "None"
> sname = x[1]
> if sname == "":
> sname == "None"
>
> print ""+fname+""+""+sname+""
"Gabriel Genellina" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> At Monday 25/12/2006 21:24, Paul McGuire wrote:
>
>>For example, for all the complexity in writing Sudoku solvers, there are
>>fewer than 3.3 million possible permutations of 9 rows of the digits 1-9,
>>and far fewer
Carsten Haese wrote:
> On Tue, 2006-12-26 at 13:08 -0800, John Machin wrote:
> > Wojciech Mula wrote:
> > > Steve Bergman wrote:
> > > > I'm looking for a module to do fuzzy comparison of strings. [...]
> > >
> > > Check module difflib, it returns difference between two sequences.
> >
> > and it's
Found out a quite fun way to store persistent variables in functions in
python.
def doStuff():
try:
#Will throw exception if not set
doStuff.timesUsed
##
#Insert stuff to do each time the function is called here
##
doStuff.timesUsed+=1
print "Function call!"
excep
Scott David Daniels wrote:
> Peter Machell wrote:
>> ZeD wrote:
>>
>> Thanks very much ZeD. This will do what I need to.
>> The next step is to do some regex on the phone number to ensure it's
>> local and correct. How can I split these up so each value has a key?
>
> Well, you should try that,
At Tuesday 26/12/2006 18:08, John Machin wrote:
Wojciech Mula wrote:
> Steve Bergman wrote:
> > I'm looking for a module to do fuzzy comparison of strings. [...]
>
> Check module difflib, it returns difference between two sequences.
and it's intended for comparing text files, and is relatively
On Tue, 2006-12-26 at 13:08 -0800, John Machin wrote:
> Wojciech Mula wrote:
> > Steve Bergman wrote:
> > > I'm looking for a module to do fuzzy comparison of strings. [...]
> >
> > Check module difflib, it returns difference between two sequences.
>
> and it's intended for comparing text files, a
Ross Ridge wrote:
> Ben Sizer wrote:
> > I've installed several different versions of Python across several
> > different versions of MS Windows, and not a single time was the Python
> > directory or the Scripts subdirectory added to the PATH environment
> > variable.
>
> Personally, I hate Windows
At Tuesday 26/12/2006 13:57, Andreas Lysdal wrote:
I'm a noob at python so..
I just want to know, is there a function to type text global not in the
program but in other programs(like you where typing it).
For example in a textbox, in a program like "cmd.exe" or "notebook.exe".
I'm using windo
At Tuesday 26/12/2006 10:25, [EMAIL PROTECTED] wrote:
I need a function (blocking or non-blocking) that tells me if a key has
been pressed (even before it has been released etc.). Also, I would of
course like to know _which_ key has been pressed.
On Windows you can listen to the messages WM_KE
This, which is from a real web site, went into BeautifulSoup:
And this came out, via prettify:
>>&linkurl;=/Europe/Spain/Madrid/Apartments/Offer/2408" />
BeautifulSoup seems to have become confused by the ">>>" within
a quoted attribute value. It first parsed it right, but then stuck
Wojciech Mula wrote:
> Steve Bergman wrote:
> > I'm looking for a module to do fuzzy comparison of strings. [...]
>
> Check module difflib, it returns difference between two sequences.
and it's intended for comparing text files, and is relatively slow.
Google "python levenshtein". You'll probably
On Tue, 2006-12-26 at 17:39 -0300, Gabriel Genellina wrote:
> At Monday 25/12/2006 21:24, Paul McGuire wrote:
>
> >For example, for all the complexity in writing Sudoku solvers, there are
> >fewer than 3.3 million possible permutations of 9 rows of the digits 1-9,
> >and far fewer permutations tha
Thanks Fredrik and Carsten,
I'll try marshal module.
> * Your code snippet is a statement, actually, a suite of statements. You
> need to exec it, not eval it.
> * You seem to think that eval'ing or exec'ing a code object will
> magically capture its output stream. It won't.
Oh, it's my mistake.
On 12/26/06, Gabriel Genellina <[EMAIL PROTECTED]> wrote:
> At Monday 25/12/2006 21:24, Paul McGuire wrote:
>
> >For example, for all the complexity in writing Sudoku solvers, there are
> >fewer than 3.3 million possible permutations of 9 rows of the digits 1-9,
> >and far fewer permutations that m
Peter Machell wrote:
> ZeD wrote:
>
> Thanks very much ZeD. This will do what I need to.
> The next step is to do some regex on the phone number to ensure it's
> local and correct. How can I split these up so each value has a key?
Well, you should try that, unless you intend to get the newsgrou
At Monday 25/12/2006 21:24, Paul McGuire wrote:
For example, for all the complexity in writing Sudoku solvers, there are
fewer than 3.3 million possible permutations of 9 rows of the digits 1-9,
and far fewer permutations that match the additional column and box
constraints. Why not just comput
ZeD wrote:
> Peter Machell wrote:
>
>> I have an application where I need to take a query from an existing
>> database and send it to a web api.
>
> [...]
>
>> There are always 5 values, but some are blank and some are 'None'.
>> I'd like to split the lines so I get something resembling XML, lik
On Tue, 2006-12-26 at 14:48 -0500, Carsten Haese wrote:
> * Code objects come in two flavors: statements and expressions.
> * exec can execute a 'statement' flavored code object.
> * eval can evaluate an 'expression' flavored code object.
> * Your code snippet is a statement, actually, a suite of s
On Tue, 2006-12-26 at 11:15 -0800, [EMAIL PROTECTED] wrote:
> Hi,
>
> It is possible to get bytecode from code object.
> Reversely, is it possible to create code object from bytecode?
>
> ex.
> ## python code (not a module)
> pycode = '''\
> print "\n"
> for item in items:
> print "
[EMAIL PROTECTED] wrote:
> It is possible to get bytecode from code object.
> Reversely, is it possible to create code object from bytecode?
>
> ex.
> ## python code (not a module)
> pycode = '''\
> print "\n"
> for item in items:
> print "%s\n" % item
> print "\n"
> '''
>
>
In my web application I use Apache and mod_python.
I allow users to upload huge files( via HTTP FORM , using POST method)
I would like to store the file directly on a hard disk and not to
upload the WHOLE huge file into server's memory first.
Can anyone suggest a solution?
Thank you
LB
--
http:/
Hi,
It is possible to get bytecode from code object.
Reversely, is it possible to create code object from bytecode?
ex.
## python code (not a module)
pycode = '''\
print "\n"
for item in items:
print "%s\n" % item
print "\n"
'''
## compile it and get bytecode
code = compile
[EMAIL PROTECTED] wrote:
> I need a function (blocking or non-blocking) that tells me if a key has
> been pressed (even before it has been released etc.). Also, I would of
> course like to know _which_ key has been pressed.
>
> I know that this probably does not exist in the Python library already
Hi,
I created a Google Custom Search Engine for searching on:
"Software / Compilers / Optimization"
This is basically a regular full Google search giving preference to
technical sites such as IEEE, ACM, citeseer, the Universities,
news-group (this one included), commercial sites such as Intel,
Andreas Lysdal <[EMAIL PROTECTED]> wrote:
>> P.S. apos is handled specially as it isn't technically a
>> valid html entity (and Python doesn't include it in its entity
>> list), but it is an xml entity and recognised by many browsers so some
>> people might use it in html.
>>
> Hey i fund this
Ben Sizer wrote:
> I've installed several different versions of Python across several
> different versions of MS Windows, and not a single time was the Python
> directory or the Scripts subdirectory added to the PATH environment
> variable. Every time, I've had to go through and add this by hand, t
Dan Jacobson wrote:
> Can I feel even better about using perl vs. python, as apparently
> python's dependence of formatting, indentation, etc. vs. perl's
> "(){};" etc. makes writing python programs perhaps very device
> dependent. Whereas perl can be written on a tiny tiny screen, and can
> withst
Steve Bergman wrote:
> I'm looking for a module to do fuzzy comparison of strings. [...]
Check module difflib, it returns difference between two sequences.
--
http://mail.python.org/mailman/listinfo/python-list
Duncan Booth skrev:
> "Felipe Almeida Lessa" <[EMAIL PROTECTED]> wrote:
>
>
>> On 26 Dec 2006 04:22:38 -0800, placid <[EMAIL PROTECTED]> wrote:
>>
>>> So do you want to remove "&" or replace them with "&" ? If you
>>> want to replace it try the following;
>>>
>> I think he wants to
I'm looking for a module to do fuzzy comparison of strings. I have 2
item master files which are supposed to be identical, but they have
thousands of records where the item numbers don't match in various
ways. One might include a '-' or have leading zeros, or have a single
character missing, or a
Felipe Almeida Lessa wrote:
> On 26 Dec 2006 04:22:38 -0800, placid <[EMAIL PROTECTED]> wrote:
>
>> So do you want to remove "&" or replace them with "&" ? If you want
>> to replace it try the following;
>
>
> I think he wants to replace them, but just the invalid ones. I.e.,
>
> This & this &
"Dave Borne" <[EMAIL PROTECTED]> wrote in
news:[EMAIL PROTECTED]:
> Thanks, Paul. I didn't know about textwrap, that's neat.
>
> Leon,
> so in my example change
>> data1= [testdata[x:x+colwidth] for x in
>> range(0,len(testdata),colwidth)]
> to
>> data1 = textwrap.wrap(testdata,colwidth)
>> dat
Hey gang-
I just ran into the fabled "Secure Sockets not enabled in ActivePython,"
and the ActiveState FAQ says I should just grab _ssl.pyd from
"somewhere", offering up the python.org distribution as a possible
source.
I'm on 2.4 at this time, and python.org has what appears to be a
considerably
On Dec 26, 8:53 am, Larry Bates <[EMAIL PROTECTED]> wrote:
> Osiris wrote:
> > what is a usefull IDE for Python on Windows ?
I am a happy user of jEDIT.
--
http://mail.python.org/mailman/listinfo/python-list
"Felipe Almeida Lessa" <[EMAIL PROTECTED]> wrote:
> On 26 Dec 2006 04:22:38 -0800, placid <[EMAIL PROTECTED]> wrote:
>> So do you want to remove "&" or replace them with "&" ? If you
>> want to replace it try the following;
>
> I think he wants to replace them, but just the invalid ones. I.e.,
>
Hey,
I'm a noob at python so..
I just want to know, is there a function to type text global not in the
program but in other programs(like you where typing it).
For example in a textbox, in a program like "cmd.exe" or "notebook.exe".
I'm using windows xp.
Thanks! :)
/Scripter47
--
http://m
Osiris wrote:
> what is a usefull IDE for Python on Windows ?
>
> I saw Eric mentioned.. is that WinXP or Linux ?
>
> What does "everybody" use ?
>
> I was considering using old and very stable C-code in a new web
> application via Python/Plone/Zope.
I like pyscripter, available here:
http://
"Paul McGuire" <[EMAIL PROTECTED]> wrote:
> By the way, this variable contains only 3 (very long) lines of text,
> one for each paragraph. (Not immediately obvious after Usenet wraps
> the text.)
Usenet doesn't wrap text, all it has is a convention which suggests that
people posting to usenet sh
PySchool Phase II
I just wanted to thank everyone for filling out the survey a few months
back for my PySchool graduate school project. I was able to capture a
lot of good information from the community. For the people who
mentioned to me that I should expand the "What Linux Operating System
do yo
"Paul McGuire" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> gettysburgAddress = """Four score and seven years ago...
By the way, this variable contains only 3 (very long) lines of text, one for
each paragraph. (Not immediately obvious after Usenet wraps the text.)
-- Paul
On 26 Dec 2006 04:22:38 -0800, placid <[EMAIL PROTECTED]> wrote:
> So do you want to remove "&" or replace them with "&" ? If you want
> to replace it try the following;
I think he wants to replace them, but just the invalid ones. I.e.,
This & this & that
would become
This & this & that
No, i
Thanks, Paul. I didn't know about textwrap, that's neat.
Leon,
so in my example change
> data1= [testdata[x:x+colwidth] for x in range(0,len(testdata),colwidth)]
to
> data1 = textwrap.wrap(testdata,colwidth)
> data1 = [x.ljust(colwidth) for x in data1]
oh and I made a mistake that double spaces i
On 26 Dec 2006 04:14:27 -0800, Leon <[EMAIL PROTECTED]> wrote:
> I'm creating a python script that can take a string and print it to the
> screen as a simple multi-columned block of mono-spaced, unhyphenated
> text based on a specified character width and line hight for a column.
Hi, Leon,
For pu
"Leon" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> I'm creating a python script that can take a string and print it to the
> screen as a simple multi-columned block of mono-spaced, unhyphenated
> text based on a specified character width and line hight for a column.
> For
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote
> [EMAIL PROTECTED] wrote:
>>
>> I have tried your method, but I found it didn't work as expected.
>>
>> The output produced by the external function couldn't be depressed,
>> but the "print " statement i wrote in python is depressed. It seems
>> make cS
Hi Luis,
Luis Armendariz wrote:
> There's no need for savestdout. There's a backup copy in sys.__stdout__
Depending on the code that ran before the call to the
function run_without_stdout, sys.stdout may not be
the same as sys.__stdout__ . Of course, you also have
to be careful regarding threads
I need a function (blocking or non-blocking) that tells me if a key has
been pressed (even before it has been released etc.). Also, I would of
course like to know _which_ key has been pressed.
I know that this probably does not exist in the Python library already
as a platform-independant abstract
[EMAIL PROTECTED] wrote:
>
> I have tried your method, but I found it didn't work as expected.
>
> The output produced by the external function couldn't be depressed,
> but the "print " statement i wrote in python is depressed. It seems
> make cStringIO.StringIO() as a temporary replacement of sys.
[EMAIL PROTECTED] wrote:
> Steven D'Aprano wrote:
> > Try something like this:
> >
> > # WARNING: untested
> > def run_without_stdout(*args, **kwargs):
> > function = args[0]
> > args = args[1:]
> > savestdout = sys.stdout
> > sys.stdout = cStringIO.StringIO()
> > result = None
On 25 Dec 2006 21:50:15 -0800, many_years_after wrote
> While , there is something wrong in my expression. What I mean is the
> thread will wait some time after doing some tasks. I want to know is
> there any method to end the thread or make it out of execution of
> waiting. I use time.sleep() to l
Leon wrote:
> Hi,
>
> I'm creating a python script that can take a string and print it to the
> screen as a simple multi-columned block of mono-spaced, unhyphenated
> text based on a specified character width and line hight for a column.
> For example, if i fed the script an an essay, it would for
For people that will read the posts in the future, there is a little
bug (it doesn't change the output of this program):
items = alist[:]
Has to be:
alist = alist[:]
Sorry,
bye,
bearophile
--
http://mail.python.org/mailman/listinfo/python-list
Hello,
I'm trying to write a program to send python statements to a python
server via tcp and then get back results via a tcp connection. It
nearly works ... but I'm totally lost with the embedded dictionary (I'm
quite new to python).
The first part of the server start the python interpreter via
P
Steven D'Aprano wrote:
> Try something like this:
>
> # WARNING: untested
> def run_without_stdout(*args, **kwargs):
> function = args[0]
> args = args[1:]
> savestdout = sys.stdout
> sys.stdout = cStringIO.StringIO()
> result = None
> try:
> result = function(*args,
Peter Machell wrote:
> I have an application where I need to take a query from an existing
> database and send it to a web api.
[...]
> There are always 5 values, but some are blank and some are 'None'.
> I'd like to split the lines so I get something resembling XML, like this:
> Frank
> Spencer
John Nagle wrote:
> I've been parsing existing HTML with BeautifulSoup, and occasionally
> hit content which has something like "Design & Advertising", that is,
> an "&" instead of an "&". Is there some way I can get BeautifulSoup
> to clean those up? There are various parsing options related to
Hi,
I'm creating a python script that can take a string and print it to the
screen as a simple multi-columned block of mono-spaced, unhyphenated
text based on a specified character width and line hight for a column.
For example, if i fed the script an an essay, it would format the text
like a news
many_years_after wrote:
> Carsten Haese wrote:
> > On Sun, 2006-12-24 at 22:55 -0800, many_years_after wrote:
> > > Hi, pythoners:
> > >
> > > There is a problem I couldn't dispose. I start a thread in the my
> > > program. The thread will do something before executing time.sleep().
> > > Wh
I have an application where I need to take a query from an existing
database and send it to a web api.
Here's a cut down version of my existing code:
for foo in mssql.fetch_array();
bar = foo[2] #trims the first result which we don't use
for x in bar:
for y in x
On Tuesday, 26.12.06 at 21:28, Steven D'Aprano wrote:
>
> # WARNING: untested
> def run_without_stdout(*args, **kwargs):
> function = args[0]
> args = args[1:]
> savestdout = sys.stdout
> sys.stdout = cStringIO.StringIO()
> result = None
> try:
> result = function(*
On Tue, 26 Dec 2006 15:49:10 +0800, [EMAIL PROTECTED] wrote:
> Hi,
>
> I'm writing a program which imports an external module writing in C and
> calls a function provided by the module to do my job. But the method
> produces
> a lot of output to the stdout, and this consumes most of the running
Lad schrieb:
> On my website I allow users to upload files. I would like a user to see
> how much time is left before a file is uploaded. So, I would like to
> have a progress bar during a file uploading. Can Python help me with
> that?Or how can be a progress bar made?
> Thank you for ideas.
> L
86 matches
Mail list logo