After much optimisation it turns out the following code does the job
for me. In the end using count didn't give me the flexibility I
needed. Instead I now name each thread and track them accordingly.
It's arguable if I need the thread locking now though, however I have
left it in to remind me of
On 28 Oct 2005 06:51:36 -0700, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>First of all, this isn't a text file, it is a binary file. Secondly,
>substrings can overlap. In the sequence 0010010 the substring 0010
>occurs twice.
>
ISTM you better let others know exactly what you mean by this, be
On Fri, 28 Oct 2005 20:03:17 -0700, [EMAIL PROTECTED] (Alex Martelli) wrote:
>Mike Meyer <[EMAIL PROTECTED]> wrote:
> ...
>> Except if you can't read the file into memory because it's to large,
>> there's a pretty good chance you won't be able to mmap it either. To
>> deal with huge files, the
[EMAIL PROTECTED] wrote:
> I have a very long list of parameters coming from a web form to my
> method foo(self, **kwargs)
>
> I would like to avoid manually binding the variables to the values
> coming through the **kwargs dictionary, just to keep the code cleaner,
> I'd like to bind them automa
Bengt Richter wrote:
> On Fri, 28 Oct 2005 20:03:17 -0700, [EMAIL PROTECTED] (Alex Martelli)
> wrote:
>
>>Mike Meyer <[EMAIL PROTECTED]> wrote:
>> ...
>>> Except if you can't read the file into memory because it's to large,
>>> there's a pretty good chance you won't be able to mmap it either.
[EMAIL PROTECTED] napisał(a):
> Windows doesn't have a HOME environment variable, but it does have
> HOMEDRIVE and HOMEPATH. Could Windows versions of Python automatically
> populate os.environ with HOME, where HOME =
> os.path.join(os.environ['HOMEDRIVE'], os.environ['HOMEPATH'])?
MS recommends
Hi !
Not the good answer, but, for information :
AutoIt is very better in beta-release (many versions beta exist). AutoIt
beta can use COM call, and can use COM-server writed in Python with win32all
(PyWin).
And, also, AutoIt exist like Active-X (in reality a COM server), who can to
do used
KraftDiner wrote:
> unzip doesn't seem to work for me...
Mrmpf, my bad. The operation is called unzip, but implpemented by using
zip - so
unzip(l) == zip(*l)
So the exchange unzip with zip in my example.
Diez
--
http://mail.python.org/mailman/listinfo/python-list
On Sat, 28 Oct 2005, GregM wrote:
> ST_zeroMatch = 'You found 0 products'
> ST_zeroMatch2 = 'There are no products matching your selection'
>
> # why does this always drop through even though the If should be true.
> if (ST_zeroMatch or ST_zeroMatch2) in self.webpg:
This code - i do
Dennis Lee Bieber wrote:
> On Fri, 28 Oct 2005 09:48:27 -0400, "Colin J. Williams"
> <[EMAIL PROTECTED]> declaimed the following in comp.lang.python:
>
>
>
>>I'm no Windows expert but I think that, using Windows Explorer, one can,
>>with a right mouse click, select "Open With".
There are seve
> "g.franzkowiak" <[EMAIL PROTECTED]> (gf) wrote:
>gf> If starts a process with popen2.popen3('myprogram') and myprogram.exe is
>gf> running before, I've a connection to the second process, not to the first.
>gf> I can find the process by name before I start a process with popen2...,
>gf> but
Cool, even better. So what's best, having code to add HOME
(=USERPROFILE) to os.environ, or change the various places that HOME is
used to check for USERPROFILE?
--
http://mail.python.org/mailman/listinfo/python-list
I use htmlize for that. you can try that.
http://fly.srk.fer.hr/~hniksic/emacs/htmlize.el
--
http://mail.python.org/mailman/listinfo/python-list
Based on information from Jarek Zgoda in another thread on the Windows
USERPROFILE environment variable, debug.py should be:
import sys
from pdb import pm, set_trace
from inspect import getmembers
if sys.platform == 'win32':
import os
os.environ['HOME'] = os.environ['USERPROFILE']
del sys.
Hi,all:
Could someone explan the python thread to me?
When I use the python thread,I find some problems.If I run many
(such as 100) python threads ,then all thread are blocked.Below is the code:
import thread,time
def f():
print 'f()'
On 2005-10-29, Piet van Oostrum <[EMAIL PROTECTED]> wrote:
>> "g.franzkowiak" <[EMAIL PROTECTED]> (gf) wrote:
>
>>gf> If starts a process with popen2.popen3('myprogram') and myprogram.exe is
>>gf> running before, I've a connection to the second process, not to the
>>first.
>>gf> I can find th
Thank you for your replays (both for WMI and AutoIt beta-release)
but I would be satisfied if I had in Linux something similar to
the standard version of AutoIt!
Concerning WMI, a part the fact that it works only under Windows,
from the examples I have seen, IMHO it is much less powerful than
AutoI
Thank you for your replays (both for WMI and AutoIt beta-release)
but I would be satisfied if I had in Linux something similar to
the standard version of AutoIt!
Concerning WMI, a part the fact that it works only under Windows,
from the examples I have seen, IMHO it is much less powerful than
AutoI
> "Gordon" == Gordon Airporte <[EMAIL PROTECTED]> writes:
Gordon> I'm wondering if this is might be bad practice. Sometimes
Gordon> when I need to pass around several pieces of datum I will
Gordon> put them in a tuple, then when I need to use them in a
Gordon> receiving functio
Grant Edwards a écrit :
> On 2005-10-29, Piet van Oostrum <[EMAIL PROTECTED]> wrote:
>
>>>"g.franzkowiak" <[EMAIL PROTECTED]> (gf) wrote:
>>
>>>gf> If starts a process with popen2.popen3('myprogram') and myprogram.exe is
>>>gf> running before, I've a connection to the second process, not to t
<[EMAIL PROTECTED]> wrote:
> """
> I was looking for something similar (XML to DTD inference) but I didn't
> find anything related in python. Trang
> (http://www.thaiopensource.com/relaxng/trang-manual.html#introduction),
> on the other hand seems impressive after a few non-trivial tests. It
> wou
[EMAIL PROTECTED] wrote:
> But then I changed idea... Also if it is already one year that I try
> to find a solution in Linux (mainly with Python or DCOP and KDE),
This doesn't express the question you have anywhere clearly enough. Linux
can run perfectly happily without any form of windowing e
Quoth Pierre Hanser <[EMAIL PROTECTED]>:
| Grant Edwards a écrit :
|> On 2005-10-29, Piet van Oostrum <[EMAIL PROTECTED]> wrote:
|>>>"g.franzkowiak" <[EMAIL PROTECTED]> (gf) wrote:
|>>
|>>>gf> If starts a process with popen2.popen3('myprogram') and myprogram.exe is
|>>>gf> running before, I've
<[EMAIL PROTECTED]> wrote:
...
> But the problem is that in Linux you can't even send a keystroke to
> a running GUI application!
Actually, if the app is running under X11 you may try to fake out a
keystroke event (with low level calls, but ctypes might let you use it
from Python). Of course,
I've been working with python 2.2.3 for the last couple of weeks, but
would like to move up to 2.4. I grabbed the 2.4.2 tarball and attempted to
install, but I get:
gcc -pthread -c -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes
-I. -I./Include -DPy_BUILD_CORE -o Modules/python.o
[EMAIL PROTECTED] wrote:
> Cool, even better. So what's best, having code to add HOME
> (=USERPROFILE) to os.environ, or change the various places that HOME is
> used to check for USERPROFILE?
Best solution would be to have portable function that returns
user home directory and knows about all pl
Dan M wrote:
> /usr/include/sys/event.h:53: error: syntax error before "u_int"
> /usr/include/sys/event.h:55: error: syntax error before "u_short"
> *** Error code 1
>
> Stop in /usr/local/src/Python-2.4.2.
>
> immediately upon running "make". I took at look at event.h to see if I
> could find an
Peter Otten wrote:
> [EMAIL PROTECTED] wrote:
>
>
>>I have a very long list of parameters coming from a web form to my
>>method foo(self, **kwargs)
>>
>>I would like to avoid manually binding the variables to the values
>>coming through the **kwargs dictionary, just to keep the code cleaner,
>>I'
I'm using py.log for logging and I find that I end up having the
following pattern emerge within my code (influenced by
http://agiletesting.blogspot.com/2005/06/keyword-based-logging-with-py-library.html):
def foo(**kwargs):
log.foo(kwargs)
#body form
This led me to believe that I could
[EMAIL PROTECTED] (Alex Martelli) writes:
>...
>> But the problem is that in Linux you can't even send a keystroke to
>> a running GUI application!
> Actually, if the app is running under X11 you may try to fake out a
> keystroke event (with low level calls, but ctypes might let you use it
> f
I'm looking for a "pythonic" GTK Undo library/class. It would have a
framework for Undo/Redo, and would provide Undo/Redo for TextView,
Entry, and containers and other classes. In a "batteries included"
fashion, just instantiating a "UndoableTextView" or "UndoableEntry" or
"UndoableContainer"
Hi, I have a file with this content:
xxx xx x xxx
1
0
0
0
1
1
0
(many more 1's and 0's to follow)
y yy yyy yy y yyy
The x's and y's are FIXED and known words which I will ignore, such as
"This is the start of the file" and "This is the end of the file". The
dig
yoda <[EMAIL PROTECTED]> wrote:
> I'm using py.log for logging and I find that I end up having the following
> pattern emerge within my code (influenced by
> http://agiletesting.blogspot.com/2005/06/keyword-based-logging-with-py-lib
> rary.html):
>
> def foo(**kwargs):
> log.foo(kwargs)
>
Mike Meyer wrote:
[snip]
>for name, value in kwargs.items():
>if name in ('a', 'list', 'of', 'valid', 'keywords'):
> exec "%s = %s" % (name, value)
>else:
> raise ValueError, "Unrecognized keyword " + name
>
> Others will probably tell you that you really sho
Your SubElement call is lacking the attrib argument, but you can't set
text, anyway.
The elementtree source makes it clear, you can only set element attrib
attributes
with SubElement
def SubElement(parent, tag, attrib={}, **extra):
attrib = attrib.copy()
attrib.update(extra)
element =
On Sat, 29 Oct 2005 10:34:24 +0200, Peter Otten <[EMAIL PROTECTED]> wrote:
>Bengt Richter wrote:
>
>> On Fri, 28 Oct 2005 20:03:17 -0700, [EMAIL PROTECTED] (Alex Martelli)
>> wrote:
>>
>>>Mike Meyer <[EMAIL PROTECTED]> wrote:
>>> ...
Except if you can't read the file into memory because it
Steve Holden wrote:
>> Why don't you just change the method signature to foo(self, x, y, z,
>> whatever, **kwargs)?
> Probably because values are then required for those arguments. Plus it's
> a lot of work to specify "a very long list", and the list will also need
> maintaining.
Note that I ke
> Grant Edwards <[EMAIL PROTECTED]> (GE) wrote:
>GE> On 2005-10-29, Piet van Oostrum <[EMAIL PROTECTED]> wrote:
"g.franzkowiak" <[EMAIL PROTECTED]> (gf) wrote:
>>>
>gf> If starts a process with popen2.popen3('myprogram') and myprogram.exe is
>gf> running before, I've a connection to
Bengt Richter <[EMAIL PROTECTED]> wrote:
...
> >>>while block:
> >>>block = block[-overlap:] + f.read(blocksize-overlap)
> >>>if block: yield block
...
> I was thinking this was an example a la Alex's previous discussion
> of interviewee code challenges ;-)
>
> What struc
"David Schwartz" <[EMAIL PROTECTED]> wrote:
>Paul Rubin wrote:
>
>> "David Schwartz" <[EMAIL PROTECTED]> writes:
>
>>> To call it an "established legal fact" is to grossly distort the
>>> circumstances under which it was determined and upheld.
>
>> Who is paying you to post such nonsense?
>
>
Bengt Richter wrote:
> What struck me was
>
> >>> gen = byblocks(StringIO.StringIO('no'),1024,len('end?')-1)
> >>> [gen.next() for i in xrange(10)]
> ['no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no']
Ouch. Seems like I spotted the subtle cornercase error and missed the big
one.
Peter
On 2005-10-29, Tony Nelson <[EMAIL PROTECTED]> wrote:
> I'm looking for a "pythonic" GTK Undo library/class. It would have a
You might ask the authors of Kiwi if they plan to add undo/redo. Or help
them add it if you can.
http://www.async.com.br/projects/kiwi/
It would be great to have this
"Ask" <[EMAIL PROTECTED]> wrote:
>
>Hi TIm,
>
>Ahh I see.. (Told you I was a newby!) ;-)
>
>Tkinter is what I'm using as that was loaded by default with the
>installation of Python I am using.
Now your question makes good sense, especially if you were coming from
something like the Win32 API.
I
dawenliu wrote:
> Hi, I have a file with this content:
> xxx xx x xxx
> 1
> 0
> 0
> 0
> 1
> 1
> 0
> (many more 1's and 0's to follow)
> y yy yyy yy y yyy
>
> The x's and y's are FIXED and known words which I will ignore, such as
> "This is the start of the file"
dawenliu wrote:
> Hi, I have a file with this content:
> xxx xx x xxx
> 1
> 0
> 0
> 0
> 1
> 1
> 0
> (many more 1's and 0's to follow)
> y yy yyy yy y yyy
>
> The x's and y's are FIXED and known words which I will ignore, such as
> "This is the start of the file"
"Mike Meyer" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> "Paul Watson" <[EMAIL PROTECTED]> writes:
...
> Did you do timings on it vs. mmap? Having to copy the data multiple
> times to deal with the overlap - thanks to strings being immutable -
> would seem to be a lose, and makes
Peter Otten wrote:
> Steve Holden wrote:
>
>
>>>Why don't you just change the method signature to foo(self, x, y, z,
>>>whatever, **kwargs)?
>
>
>>Probably because values are then required for those arguments. Plus it's
>>a lot of work to specify "a very long list", and the list will also need
I think implementing a finite state automaton would be a good (best?)
solution. I have drawn a FSM for you (try viewing the following in
fixed width font). Just increment the count when you reach state 5.
<---|
||
0 0
I feel so stupid... lol... now why didn't I think of that?
Thanks Alex.
--
http://mail.python.org/mailman/listinfo/python-list
Thanks Kent. The code looks reasonable, but the result is that, the
output file comes out identical as the input file, with all the
and remaining inside.
--
http://mail.python.org/mailman/listinfo/python-list
I've been using generators to implement backtracking search for a while
now. Unfortunately, my code is large and complex enough (doing
unification on math expressions) that its hard to post a simple
example. So I decided to look for a simpler problem that could be used
to demonstrate the technique
Peter Otten wrote:
> Bengt Richter wrote:
>
>
>>What struck me was
>>
>>
> gen = byblocks(StringIO.StringIO('no'),1024,len('end?')-1)
> [gen.next() for i in xrange(10)]
>>
>>['no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no']
>
>
> Ouch. Seems like I spotted the subtle cornerca
I've changed the code a little bit and works fine now:
inf = open('input.txt')
out = open('output.txt', 'w')
skips = [
'xxx xx x xxx',
'y yy yyy yy y yyy']
for line in inf:
flag = 0
for skip in skips:
if skip in line:
flag = 1
continue
i
Hi, I'm reading a file line by line, and whenever a line is not
consisted of a single number (such as 0.315), I want to discard that
line (and store only the single numbers).
For example,
0.315
discarded this line of text
3.8
-1.44
forget about me also
2.6
Then I want to store only the four num
On 2005-10-29, Piet van Oostrum <[EMAIL PROTECTED]> wrote:
>>GE> That would require that the application know about the named
>>GE> pipe and open it. I don't think there is any way to swap a
>>GE> pipe in for stdin/stdout once a process is running.
>
> Sure. 'myprogram' should be designed to comm
This is a possible solution, using exceptions:
fileName = "data"
out = file(fileName + "_filt.txt", "w")
for line in file(fileName + ".txt"):
try:
nline = float(line)
except ValueError:
pass
else:
out.write(str(nline) + "\n")
out.close()
If the file is small en
Steven D'Aprano <[EMAIL PROTECTED]> wrote:
>
>On Fri, 28 Oct 2005 15:29:46 +0200, Björn Lindström wrote:
>
>> "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes:
>>
>>> f = open("filename", "rb")
>>> s = f.read()
>>> sub = "\x00\x00\x01\x00"
>>> count = s.count(sub)
>>> print count
>>
>> That's a lot
Paul Watson wrote:
> Here is a better one that counts, and not just detects, the substring. This
> is -much- faster than using mmap; especially for a large file that may cause
> paging to start. Using mmap can be -very- slow.
>
>
> ...
> b = fp.read(blocksize)
> count = 0
> while len(b) > b
Tim Roberts <[EMAIL PROTECTED]> wrote:
...
> >> print file("filename", "rb").read().count("\x00\x00\x01\x00")
> >
> >Funny you should say that, because I can't stand unnecessary one-liners.
> >
> >In any case, you are assuming that Python will automagically close the
> >file when you are done.
>
dawenliu <[EMAIL PROTECTED]> wrote:
> Hi, I have a file with this content:
> xxx xx x xxx
> 1
> 0
> 0
> 0
> 1
> 1
> 0
> (many more 1's and 0's to follow)
> y yy yyy yy y yyy
>
> The x's and y's are FIXED and known words which I will ignore, such as
> "This is t
Talin <[EMAIL PROTECTED]> wrote:
> even simpler - for examle, the idea of being able to return the output
> of one generator directly from another instead of having to iterate
> through all of the results and then re-yield them has already been
> discussed in this forum.
I missed those discussion
Hello!
Please take a look at the example.
>>> a = [(x, y) for x, y in map(None, range(10), range(10))] # Just a list of
>>> tuples
>>> a
[(0, 0), (1, 1), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6), (7, 7), (8,
8), (9, 9)]
Now i want to get a list of functions x*y/n, for each (x, y) in a:
>>> funcs
Max Rybinsky <[EMAIL PROTECTED]> wrote:
...
> >>> funcs = [lambda n: x * y / n for x, y in a]
...
> It seems, all functions have x and y set to 9.
> What's wrong with it? Is it a bug?
It's known as *late binding*: names x and y are looked up when the
lambda's body is executing, and at that t
In article <[EMAIL PROTECTED]>,
Dave Cook <[EMAIL PROTECTED]> wrote:
> On 2005-10-29, Tony Nelson <[EMAIL PROTECTED]> wrote:
>
> > I'm looking for a "pythonic" GTK Undo library/class. It would have a
>
> You might ask the authors of Kiwi if they plan to add undo/redo. Or help
> them add it i
[EMAIL PROTECTED] wrote:
> I think implementing a finite state automaton would be a good (best?)
> solution. I have drawn a FSM for you (try viewing the following in
> fixed width font). Just increment the count when you reach state 5.
>
> <---|
>
On 29 Oct 2005 14:25:24 -0700, Max Rybinsky <[EMAIL PROTECTED]> wrote:
>Hello!
>
>Please take a look at the example.
>
a = [(x, y) for x, y in map(None, range(10), range(10))] # Just a list of
tuples
a
>[(0, 0), (1, 1), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6), (7, 7), (8,
>8), (9, 9)
"Alex Martelli" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> In today's implementations of Classic Python, yes. In other equally
> valid implementations of the language, such as Jython, IronPython, or,
> for all we know, some future implementation of Classic, that may well
> not
Thank you for explanation, Alex.
It appears that almost every beginner to Python gets in trouble with
this ...feature. :)
--
http://mail.python.org/mailman/listinfo/python-list
"Paul Watson" <[EMAIL PROTECTED]> writes:
> How could I identify when Python code does not close files and depends on
> the runtime to take care of this? I want to know that the code will work
> well under other Python implementations and future implementations which may
> not have this provide
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes:
> Mike Meyer wrote:
> [snip]
>>for name, value in kwargs.items():
>>if name in ('a', 'list', 'of', 'valid', 'keywords'):
>> exec "%s = %s" % (name, value)
>>else:
>> raise ValueError, "Unrecognized keyword " +
[EMAIL PROTECTED] wrote:
> I think implementing a finite state automaton would be a good (best?)
> solution. I have drawn a FSM for you (try viewing the following in
> fixed width font). Just increment the count when you reach state 5.
>
> <---|
>
Hello,
I'm looking (without success so far) for code sources for common
problems in different languages, but especially Python, C, Fortran, Ada
and Matlab.
It would help people coming from other languages to understand the
'python way of thinking'.
Priority is clean code, performance is not an i
All,
I have to tell all of you this, at least for some laughs. Honestly, I
had the silliest dream involving the language last night. I dreamt
that it was a decade into the future and that Grand Central Station in
NYC was installing a cement and steel "computer core" for directing its
trains and
On Sat, 29 Oct 2005 21:08:09 +, Tim Roberts wrote:
>>In any case, you are assuming that Python will automagically close the
>>file when you are done.
>
> Nonsense. This behavior is deterministic. At the end of that line, the
> anonymous file object out of scope, the object is deleted, and t
"Paul Watson" <[EMAIL PROTECTED]> writes:
> "Mike Meyer" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>> "Paul Watson" <[EMAIL PROTECTED]> writes:
> ...
>> Did you do timings on it vs. mmap? Having to copy the data multiple
>> times to deal with the overlap - thanks to strings be
"Talin" <[EMAIL PROTECTED]> writes:
> As an alternative, I'd like to present the following implementation. If
> you compare this one with the one in lib/test/test_generator.py you
> will agree (I hope) that by using recursive generators to implement
> backtracking, the resulting code is a little mo
Steven D'Aprano wrote:
> On Fri, 28 Oct 2005 06:22:11 -0700, [EMAIL PROTECTED] wrote:
>
>>Which is quite fast. The only problems is that the file might be huge.
>
> What *you* call huge and what *Python* calls huge may be very different
> indeed. What are you calling huge?
>
I'm not saying that
dcrespo a écrit :
>>I think it would be time for you to read the Fine Manual...
>
>
> hi, thanks for your answer... I really did it the same way you
> suggested, but I forgot to tell you that I wanted to get a better way
> for doing it.
Let us know if you find one...
>
> By the way, knowing yo
Max Rybinsky <[EMAIL PROTECTED]> wrote:
> Thank you for explanation, Alex.
> It appears that almost every beginner to Python gets in trouble with
> this ...feature. :)
Almost every beginner to Python gets in trouble by expecting "do what
I'm thinking of RIGHT NOW"-binding, which no language offer
Paul Watson <[EMAIL PROTECTED]> wrote:
> "Alex Martelli" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>
> > In today's implementations of Classic Python, yes. In other equally
> > valid implementations of the language, such as Jython, IronPython, or,
> > for all we know, some f
Steven D'Aprano <[EMAIL PROTECTED]> wrote:
...
> I should also point out that for really serious work, the idiom:
>
> f = file("parrot")
> handle(f)
> f.close()
>
> is insufficiently robust for production level code. That was a detail I
> didn't think I needed to drop on the original newbie po
At first you must forgive my double posting (4 & 5 in terms of date and
4 & 7 in terms of answers). I must then thank the new comers:
Michael, Alex Martelli and Mike Meyer.
Michel wrote:
>> [EMAIL PROTECTED] wrote:
>> But then I changed idea... Also if it is already one year that I try
>> to find
"Talin" <[EMAIL PROTECTED]> wrote:
> I've been using generators to implement backtracking search for a while
> now. Unfortunately, my code is large and complex enough (doing
> unification on math expressions) that its hard to post a simple
> example. So I decided to look for a simpler problem that
Thanks everybody for their reply. I'll see what solution is best for my
case and maybe follow up here.
Thanks again,
Lorenzo
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] writes:
> My answer is the same as that given to Michael about low level
> programming.
> But I must thank anyway Alex for giving informations to such a level
> (I didn't know that under Linux there was such a level of
> sophistication with the possibility for an application to di
Steve Holden wrote:
> Indeed, but reading one byte at a time is about the slowest way to
> process a file, in Python or any other language, because it fails to
> amortize the overhead cost of function calls over many characters.
>
> Buffering wasn't invented because early programmers had nothing b
What do u think of the following? I could keep the form schema as
expected_form1_kwargs in a separate module and import * and wrap the
kwargs check done in the for loop in a function for use in the whole
site.
The elif part is useful for checkboxes which are not passed by the
browser if they're no
On Fri, 28 Oct 2005 20:00:42 +0100, Steve Holden <[EMAIL PROTECTED]> wrote:
>KraftDiner wrote:
>> I have two lists.
>> I want to sort by a value in the first list and have the second list
>> sorted as well... Any suggestions on how I should/could do this?
>>
> >>> first = [1, 3, 5, 7, 9, 2, 4, 6,
[EMAIL PROTECTED] wrote:
> if name not in expected_form1_kwargs:
> raise ValueError, "Unrecognized keyword" + name
> elif name in expected_form1_kwargs not in kwargs.keys():
> kwargs.update(name=None)
Do you mean this instead?
elif name in expected_fo
FormEncode.
[EMAIL PROTECTED] wrote:
> What do u think of the following? I could keep the form schema as
> expected_form1_kwargs in a separate module and import * and wrap the
> kwargs check done in the for loop in a function for use in the whole
> site.
>
> The elif part is useful for checkboxes
Thanks Szabolcs and Laurence, it's not the crash of python but the
crash of cygwin. We can locate the line number but when we submit the
crash to cygwin's mail list, they told us they don't speak python. So
I'm just trying to re-produce the crash in C.
Regards,
Johnny
--
http://mail.python.org
> some future Firefox version might perhaps integrate a Python engine
For those who never heard about Firefox 1.9, check the following urls.
It looks very promising:
1) http://wiki.mozilla.org/Roadmap_Scratchpad#Python_for_XUL
Python for XUL
Significant potential contributors in both the Python
The Eternal Squire wrote:
> All,
>
> I have to tell all of you this, at least for some laughs. Honestly, I
> had the silliest dream involving the language last night. I dreamt
> that it was a decade into the future and that Grand Central Station in
> NYC was installing a cement and steel "compute
hi
in python, how do one query a port to see whether it's up or not?
thanks
--
http://mail.python.org/mailman/listinfo/python-list
Did you know that online Poker pays huge money? In the last three days my wife and I have made over 343.00 USD with online poker while we slept
Want to know our secret? Click HERE
and visit a link of your choice.
--
http://mail.python.org/mailman/listinfo/python-list
http://pleac.sourceforge.net/ probably is what you're looking for. It
shows how to to stuff from the perl cookbook in a plethora of other
languages, including Python.
Kind regards Terji Petersen
--
http://mail.python.org/mailman/listinfo/python-list
Peter Hansen wrote:
> Do you mean this instead?
>
> elif name in expected_form1_kwargs and name not in kwargs:
>
> What you wrote doesn't do what you think it does... it actually tests
> for whether True or False is a key in kwargs, depending on whether "name
> in expected_form1_kwargs" ret
On Sat, 29 Oct 2005 20:21:20 -0700, eight02645999 wrote:
> hi
> in python, how do one query a port to see whether it's up or not?
> thanks
I'm an absolute beginner, but let's see if I can help. Assuming you want
to check a port on another machine,
import socket
port=25 # Port we
<[EMAIL PROTECTED]> wrote:
...
> For the other Alex observations (about Mac OsX and my examples of
> automation centered on web automation) I have a PC, and the fact that
> Python is very good at dealing with the web, doesn't help too much
> in this case...
All of your sensible use cases were
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
...
> def foo(**kwargs):
> expected_form1_kwargs = ["arg1", "arg2"]
>
> for name in expected_form1_kwargs:
> if name not in kwargs:
> kwargs[name]=None
>
> for name in kwargs:
> if name in kwargs and name not
1 - 100 of 105 matches
Mail list logo