s, the
child gracefully dies.
> [...] I doubt we can remove all the memory
> problems, but if we can get this down by another 150 - 200%, that will
> be good enough for me.
Down by more than 100% ? Wouldn't that require turning
memory leaks into memory wells?
--
--Bryan
--
http://mail.python.org/mailman/listinfo/python-list
Fredrik Lundh wrote:
>>How to generate a random number in Python. Is there any build in
>>function I can call?
>
>
> >>> import random
> >>> help(random)
If you need crypto-quality randomness:
>>> import os
>>> help(
:
data.append(s.recv(length))
length -= len(data[-1])
data = ''.join(data)
There's still a robustness problem, but in the absense of errors
and malice, that should work. I think.
--
--Bryan
--
http://mail.python.org/mailman/listinfo/python-list
how it does
on other systems.
Thanks to George ([EMAIL PROTECTED]) for testing a previous version.
Thanks to Robert Kern for pointing me to a bug solution.
--Bryan
cut ---
#!/usr/bin/env python
# Python module "errorwindow.py", by Bryan Olson,
t will serve the entire
Python community. From what I can tell, We need to address fixing the
PEP process before there is any point in working on PEP's,
--
--Bryan
--
http://mail.python.org/mailman/listinfo/python-list
rhaps the rules
> would have to be checked in a specific order.
The usual tools to deal with partial orderings are directed acyclic graphs,
and "topological sorting". Try Googling the terms along with "Python".
--
--Bryan
--
http://mail.python.org/mailman/listinfo/python-list
is claim seems pretty dubious to me.
i would not say sion's ratio of 5:1 is dubious. for what it's worth, i've
written i pretty complex program in jython over the last year. jython compiles
to java source code and the number of generated java lines to the jython lines
is 4:1.
bryan
--
http://mail.python.org/mailman/listinfo/python-list
always get not in sys.path
What am I missing? Or is pdb fubar?
Suse93 btw.
thanks,
Bryan
--
http://mail.python.org/mailman/listinfo/python-list
e" not "cale". nothing like a hot bowl of tofu kale soup
while reading the recipes in the "python cookbook".
bryan
--
http://mail.python.org/mailman/listinfo/python-list
ion. therefore, python was the
obvious choice for me.
bryan
--
http://mail.python.org/mailman/listinfo/python-list
(x1, y1), (x2, y2), ...]. to me,
it doesn't matter if you want to modify a point. if you do then create a new
one, but don't make it a list just to make it modifiable.
bryan
--
http://mail.python.org/mailman/listinfo/python-list
s a
structure,
use a tuple. if you view it a sequence, use a list. in this example, i view
it
as a stucture, so i would use (width, height) as a tuple.
bryan
--
http://mail.python.org/mailman/listinfo/python-list
mr. xah... would you be willing to give a lecture at pycon 2006? i'm sure you
would draw a huge crowd and a lot of people would like to meet you in person...
thanks.
--
http://mail.python.org/mailman/listinfo/python-list
Xah Lee wrote:
> Addendum, 200510
>
> Here's further example of Python's extreme low quality of
> documentation. In particular, what follows focuses on the bad writing
> skill aspect, and comments on some language design and quality issues
> of Python.
>
>>From the Official Python documentation o
Fredrik Lundh wrote:
> Bryan wrote:
>
>>is there a rough estimate somewhere that shows currently how many python 1.5
>>vs
>>2.2 vs 2.3 vs 2.4 users there are? have a majority moved to 2.4? or are they
>>still using 2.3? etc...
>
>
> Here are curren
is there a rough estimate somewhere that shows currently how many python 1.5 vs
2.2 vs 2.3 vs 2.4 users there are? have a majority moved to 2.4? or are they
still using 2.3? etc...
thanks,
bryan
--
http://mail.python.org/mailman/listinfo/python-list
hanks!
I'll include one below. There's a tricky bit in that most standards
assume a serial bit stream, not byte data, leading to the relection
issue discussed in the reference in the doc. Let me know if gets
the same answers as your
true and false values is to give 'not' something
sensible to return.
--
--Bryan
--
http://mail.python.org/mailman/listinfo/python-list
quot;, and then in code where you need to
> "parse" it and extract the values you can just do this:
>
> import config
> print 'Project Id is', config.PROJECT_ID
In many cases that's fine, but at least be aware that the party
supplying the config data also gets the ability to change
the behavior of the process in ways of his choosing.
--
--Bryan
--
http://mail.python.org/mailman/listinfo/python-list
Hi
does anyone have any experience using the Python Image library to
determine if a Tiff is in the G4 or G3 codec?
--
http://mail.python.org/mailman/listinfo/python-list
I just wonder about that 5-10 times faster. that's a really wide range. :)
On 9/21/05, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
> Martijn Iseger wrote:
>
> > >> Domain-specific modeling makes software development 5-10 times faster
> > >> than approaches based on UML or MDA. It accelerates develo
gt; can write
>
> a, (b ,c) = 1, (2,3)
>
> I'd like to write
>
> def foo(a, (b,c)):
> ...
>
> foo(1, (2,3))
>
> too.
>
> Diez
exactly... consistency is the most important thing here. i use this style all
the time. i will be very disappointed to find this removed from python. i'm +1
for keeping it.
bryan
--
http://mail.python.org/mailman/listinfo/python-list
Fredrik Lundh wrote:
> Bryan Olson wrote:
>
>>Next, you never create any instances of scanThread.
>
>
> one would think that the "scanThread()" part of
>
> scanThread().start()
>
> would do exactly that.
And one would be correct.
threading < MAX_THREADS
is always false. You are comparing a module to an int. Next,
you never create any instances of scanThread. Next the local
variables of scan() are not visible in scanThread.run().
--
--Bryan
> import socket
> import threading
> import traceback
>
>
it into your
'target' function; or you could subclass Thread more generally,
so your subclass adds the print and behaves exactly the same
otherwise. I regard debugging as important, but I do not
believe that this particular print warrants the general
inclusion implied.
Other Pythone
a contender.
> Are there any *practical* applications for in-memory balanced data
> structures (e.g. skip list, AVL tree, RB tree, B tree) ?
Yes, absolutely. Efficient ordered sub-ranges; efficient rank
queries; sustainable performance with adversarial inputs.
--
--Bryan
--
http://mail.python.org/mailman/listinfo/python-list
-Black trees,
AVL trees, 2-3 trees, or skip-lists, are a better choice.
--
--Bryan
--
http://mail.python.org/mailman/listinfo/python-list
just another attribute.
>a['content'] = d.get('content', None)
>attr_matches = attrs_re.finditer(d.get('attrs', None))
>for match in attr_matches:
>da = match.groupdict()
>name = da.get('name', None)
>a[name] = da.get('value', None)
>ancs.append(a)
>return ancs
--
--Bryan
--
http://mail.python.org/mailman/listinfo/python-list
enforce
> security rules.
Don't know enough about Millman's app to comment on it
specifically, but many reasonable server-side applications use a
single log-in to the database, then enforce security in the
application server. Web shopping-carts, for example, generally
work that way.
--
--Bryan
--
http://mail.python.org/mailman/listinfo/python-list
tion at all - two reasons are
> that it enhances the user experience and that it reduces the average
> load on the server.)
Good advice.
--
--Bryan
--
http://mail.python.org/mailman/listinfo/python-list
Tim Peters wrote:
> [Bryan Olson, on the problem at
> http://spoj.sphere.pl/problems/SUPPER/
> ]
>
>>I never intended to submit this program for competition. The
>>contest ranks in speed order, and there is no way Python can
>>compete with truly-compiled la
onder how many of the accepted entries would perform properly.
--
--Bryan
--
http://mail.python.org/mailman/listinfo/python-list
t(ch) for ch in stdin.readline().split()]
supers = supernumbers(sequence)
print len(supers)
for i in supers:
print i,
print
--
--Bryan
--
http://mail.python.org/mailman/listinfo/python-list
n00m wrote:
> Oops Bryan... I've removed my reply that you refer to...
> See my previous - CORRECT - reply. The code just times
> out... In some sense it doesn't matter right or wrong is
> its output.
If my code times out, then they are using an archaic platform.
With r
signed protocols.
Were I a betting man (outside of Texas Hold'em, where I am), I'd
wager that your problem is more basic. The code you're running,
the settings you're setting, or -- well -- something there, is
not right.
--
--Bryan
--
http://mail.python.org/mailman/listinfo/python-list
n00m wrote:
> Bravo, Bryan!
> It's incredibly fast!
Not compared to a good implementation for a compiled, low-level
language.
> But your code got WA (wrong answer).
> See my latest submission: http://spoj.sphere.pl/status/SUPPER/
> Maybe you slipped a kind of typo i
urse I mean only the imposed time limit).
> http://spoj.sphere.pl/status/SUPPER/
Is there a platform specified? Below is an alleged solution in Python.
--
--Bryan
#!/user/bin/env python
"""
Python 2.4 solution to:
http://spoj.sphere.pl/problems/SUPPER/
"
But I don't think
> Windows has anything like it.
It can be done on on Windows.
http://tangentsoft.net/wskfaq/articles/passing-sockets.html
--
--Bryan
--
http://mail.python.org/mailman/listinfo/python-list
n00m wrote:
> Btw, why we need send() if there is sendall()?
Mostly because sendall() can block, even if you do all the
select() and setblocking() magic. That's no problem in the
threaded architecture we're using, but a deal-breaker for a
single-threaded server.
--
--B
Alex wrote:
> But what are those with double underscore? For instance __cmp__(...)?
Those are these:
http://docs.python.org/ref/specialnames.html
--
--Bryan
--
http://mail.python.org/mailman/listinfo/python-list
ule.
http://docs.python.org/lib/module-ConfigParser.html
--
--Bryan
--
http://mail.python.org/mailman/listinfo/python-list
Bryan Olson wrote:
[Some stuff he thinks is right, but might not answer the real
question]
Definitely look into Peter Hanson's answer.
Olson's answer was about timing-out one's own Python code.
Bryan Olson has heretofore avoided referring to himself in the
third person, and w
select as readable, but the accept() can block because some
other processes took the connection.
If we need to run on Windows (and Unix), we can have one main
process handle the socket connections, and pipe the data to and
from worker processes. See the popen2 module in the Python
Standard Library
ups, for free, by asking the right
questions. Or by asking the questions right, which is the same thing but
different.
Focus. Be absolutely clear. What is it you need to know?
--
--Bryan
--
http://mail.python.org/mailman/listinfo/python-list
Bengt Richter wrote:
> Bryan Olson wrote:
>>Consider deleting the sentence in which the Python doc tries to
>>define mathematical integers.
> This is a nice site:
>
> http://mathworld.wolfram.com/WholeNumber.html
> http://mathworld.wolfram.com/topics/Integers.htm
> I cleared this up; now it reads "... set of whole numbers (positive
and negative
> ones)."
Consider deleting the sentence in which the Python doc tries to
define mathematical integers.
Integers
[In Python] There are three types of integers:
--
--Bryan
--
http://mail.python.org/mailman/listinfo/python-list
n00m wrote:
> Bryan;
> Look at how I corrected your the very first version
> (see added arguments in both functions). And now it
> really can handle multiple connections!
Ah, yes, I see. (In my defense, I had already fixed that bug in
my second version.)
--
--Br
Dennis Lee Bieber wrote:
> Bryan Olson declaimed the following in comp.lang.python:
>
>>No, my guess is that you're running an old version of Python.
>>The constant was added in the source on 27 Nov 2003; I'm not
>
>
> Are you sure of that 2003?
ror".
Hmmm... not much to go on there. I tested it on Win-XP, running
it from a command line. I set the server to ('www.googl.com',
80), and I was able to web-search through it.
Are you running XP's local firewall?
--
--Bryan
--
http://mail.python.org/mailman/listinfo/python-list
poradic
failures.
> Bryan wrote:
>
>>The client is trying to make more than one connection.
>
> I don't think so. Look at the very first line of the vbs:
>
> Set cn = CreateObject("ADODB.Connection")
>
> Create .Connection! NOT .Connections.
An ADO
s2 = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
> s2.connect((sqls_host, sqls_port))
> start_deamon_thread(sock_copy, (cn, s2, 'VB_SCRIPT:'))
> start_deamon_thread(sock_copy, (s2, cn, 'SQL_SERVER:'))
--
--Bryan
--
http://mail.python.org/mailman/listinfo/python-list
umstances,
send() will send all the data, but it's not guaranteed to do so.
With a size of 4096, you're probably O.K., but technically it's
a bug. (The slicker-than-needed thing to do would be to test
whether the outgoing socket is writable within the select, then
send() as much as you can, and keep selecting and sending until
all the data is out.)
--
--Bryan
--
http://mail.python.org/mailman/listinfo/python-list
Mike Meyer wrote:
> Bryan Olson writes:
>>With Python threads/queues how do I wait for two queues (or
>>locks or semaphores) at one call? (I know some methods to
>>accomplish the same effect, but they suck.)
>
> By "not as good as", I meant the model they
n00m wrote:
>>Bryan;
>
> I tested your code locally (in I*D*L*E) - it works fine!
Glad it worked, but I'd still disrecommend IDLE for that
version. Threads may live after the program seems to be done
(and may still own the port you need). Below is a version that
respects ^C
ects which lets the
programmer efficiently wait on many objects of various types at
one call; the Linux kernel Gurus are looking at supporting a
similar feature.
Library designers can botch the functionality by wrapping the
waitable object in their own classes with their own special wait
operatio
ne in Powerbuilder, and Powerbuilder's
mastery of databases is unmatched by anything available for
Python.
--
--Bryan
--
http://mail.python.org/mailman/listinfo/python-list
Fredrik Lundh wrote:
> Bryan Olson wrote:
>> >>>>import pydoc
>> >>>>help is pydoc.help
>> >
>> > False
>>
>>Say Fredrik, if you're going to proclaim "False"
>
> oh, I didn't proclaim anyth
Mike Meyer wrote:
> Bryan Olson writes:
>>System support for threads has advanced far beyond what Mr. Meyer
>>dealt with in programming the Amiga.
>
> I don't think it has - but see below.
>
>>In industry, the two major camps are Posix threads, and Mic
Michael Sparks wrote:
> Bryan Olson wrote:
>>A plausible theory. I have some possibly-illustrative examples
>>of what I ran into within the last few weeks.
>
>
> Did you take what you learnt, and use that to create better
> documentation to be posted on pyt
Sybren Stuvel wrote:
> I don't have any problems with the documentation. It just works for
> me. If you find any errors or omissions, fix them and send the
> document maintainer an email. Why don't you help us by improving the
> documentation?
Workin' on
Fredrik Lundh wrote:
> Bryan Olson wrote:
>>[...]
>> > What additions to that string would you suggest?
>>
>>Since "help *is* pydoc.help, or at least...", the call could
>>show the same thing as help(pydoc.help)
>
>
>>>>i
odule
interfaces well enough, but command-lines, not so much.
Anyone know of a good command-option style-guide for cross-
platform apps?
--
--Bryan
--
http://mail.python.org/mailman/listinfo/python-list
oxy_host, proxy_port))
s1.listen(5)
while 1:
cn, addr = s1.accept()
s2 = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s2.connect((sqls_host, sqls_port))
thread.start_new_thread(VB_SCRIPT,())
thread.start_new_thread(SQL_SERVER,())
--
--Bryan
--
http://mail.python.org/mailman/listinfo/python-list
tty widely used method.
>
> Don't know about Win32...
A thread for send and one for recv is also frequently used with
Winsock. Can anyone vouch for the Python wrapping?
--
--Bryan
--
http://mail.python.org/mailman/listinfo/python-list
Bengt Richter wrote:
> Bryan Olson wrote:
>>For a long time,
>>the most sophisticated software services generally have used
>>multiple lines of execution, and now that's mostly in the form
>>of threads. No one actually disagrees, but they go right on
>&g
A.M. Kuchling wrote:
> Bryan Olson wrote:
>
>>I use dir() all the time; help() not so much. Typing help(help)
>>shows:
>>
>> Help on _Helper in module site:
>>
>> Type help() for interactive help, or help(object) for help
>>
Terry Hancock wrote:
> Bryan Olson wrote:
>
>>I don't see any need to look beyond Python for a good example of
>>poor documentation. Are there serious Python programmers who
>>don't constantly struggle with errors and omissions in the doc?
>
> Uh,
else:
raise TypeError(_type_err_note), "Bad subscript type"
--
--Bryan
--
http://mail.python.org/mailman/listinfo/python-list
Robert Kern wrote:
> Bryan Olson wrote:
>
>
>> Currently, user-defined classes can implement Python
>> subscripting and slicing without implementing Python's len()
>> function. In our proposal, the '$' symbol stands for the
>>
integers as a special
case.
I wrote up and sent off my proposal, and once the PEP-Editors
respond, I'll be pitching it on the python-dev list. Below is
the version I sent (not yet a listed PEP).
--
--Bryan
PEP: -1
Title: Improved from-the-end indexing and slicing
Version: $Revision: 1.00
the former, there's no need to wait for a X.0 release; for the
latter, 3.0 may be too early.
The draft PEP went to the PEP editors a couple days ago. Haven't
heard back yet.
--
--Bryan
--
http://mail.python.org/mailman/listinfo/python-list
ny need to look beyond Python for a good example of
poor documentation. Are there serious Python programmers who
don't constantly struggle with errors and omissions in the doc?
I don't mind the 6600 line blurb form, just so long as the info
is there and is correct.
--
--Bryan
--
http://
Mike Meyer wrote:
> Bryan Olson <[EMAIL PROTECTED]> writes:
>> > Bryan Olson writes:
>> > Trivially, an 'if' statement that depends upon input
>> >>data is statically predictable. Use of async I/O means makes the
>> >>programs
Mike Meyer wrote:
> Bryan Olson writes:
> phil hunt wrote:
>
>> > What's important is *predictability*, e.g. which instruction will
>> > the computer execute next?
>> >
>> > If you only have one thread, you can tell by looking at the co
Sybren Stuvel wrote:
> Bryan Olson enlightened us with:
>
>>I recently wrote a module supporting value-shared slicing.
>
> Maybe I'm dumb, but could you explain this concept? Why would someone
> whant this?
My original motivation was reduce the amount of copyin
itude more complicated. Compare the correctness proofs of
> parallel programs with those of sequential programs.
That's an artifact of what the research community is trying to
accomplish with the proof. Proving non-trivial programs correct
is currently beyond the state of the art.
--
--Bryan
--
http://mail.python.org/mailman/listinfo/python-list
[...]
> Yes, find solutions. Don't find dangerous dead-ends that look like
> solutions but which will give you lots of trouble.
If concurrency is a dead end, why do the programs that provide
the most sophisticated services of any in the world rely on it
so heavily?
--
--Bryan
--
http://mail.python.org/mailman/listinfo/python-list
tion of -1, as both an exclusive ending
bound and the index of the last element. It bites documentation
authors who naturally think of the non-negative subscript as
*the* index of a sequence item.
--
--Bryan
--
http://mail.python.org/mailman/listinfo/python-list
Steve Holden wrote:
> Bryan Olson wrote:
>> [...] I see no good reason for the following
>> to happily print 'y'.
>>
>> s = 'buggy'
>> print s[s.find('w')]
>>
>> > Before using the result you always
e based on problems I encoutered debugging this
module, so I'm posting it partially as a concrete example of
what I was talking about.
--
--Bryan
"""
vslice.py by Bryan G. Olson, 2005
This module is free softw
Steve Holden wrote:
> Bryan Olson wrote:
>> Antoon Pardon wrote:
>> > It probably is too late now, but I always felt, find should
>> > have returned None when the substring isn't found.
>>
>> None is certainly a reasonable candidate.
[...]
&g
Antoon Pardon wrote:
> Bryan Olson schreef:
>
>>Steve Holden asked:
>>>And what are you proposing that
>>>find() should return if the substring isn't found at all? please don't
>>>suggest it should raise an exception, as index() exists to p
ists to provide that
> functionality.
There are a number of good options. A legal index is not one of
them.
--
--Bryan
--
http://mail.python.org/mailman/listinfo/python-list
ch shows yet another bug resulting from Python's handling of
negative indexes. This one is clearly a documentation error, but
the real fix is to cure the wart so that Python's behavior is
consistent enough that we'll be able to describe it correctly.
--
--Bryan
--
http://mail.python.org/mailman/listinfo/python-list
Robert Kern wrote:
> By "+1" he means, "I like it." He's not correcting you.
Ah, O.K. Thanks.
--
--Bryan
--
http://mail.python.org/mailman/listinfo/python-list
Steven Bethard wrote:
> Bryan Olson wrote:
>
>> Steven Bethard wrote:
>> > Well, I couldn't find where the general semantics of a negative
stride
>> > index are defined, but for sequences at least[1]:
>> >
>> > "The slice
n < end_bound:
result.append(sequence[i + n * k])
n += 1
return result
def show(sequence, i, m, k):
""" Print what happens, both actually and according to stated rules.
"""
print "Checking: %s[%d : %d : %d]" % (sequence, i, m, k)
print "actual :", sequence[i : m : k]
print "Kay's rule, int division :", extract_slice(sequence, i, m, k)
print "Kay's rule, real division:", extract_slice(sequence, i, m,
k, 'f')
print
show(range(5), 4, -6, -2)
--
--Bryan
--
http://mail.python.org/mailman/listinfo/python-list
Kay Schluehr wrote:
> Bryan Olson wrote:
>
>>Steven Bethard wrote:
>> > Well, I couldn't find where the general semantics of a negative stride
>> > index are defined, but for sequences at least[1]:
>> >
>> > "The slice of s from i
Paul Rubin wrote:
> Bryan Olson writes:
>
>> seq[3 : -4]
>>
>>we write:
>>
>> seq[3 ; $ - 4]
>
>
> +1
I think you're wrong about the "+1". I defined '$' to stand for
the length of the sequence (not the addre
Mike Meyer wrote:
> Bryan Olson writes:
>
>>Mike Meyer wrote:
>> > The rule I follow in choosing my tools is "Use the least complex tool
>> > that will get the job done."
>>
>>Even if a more complex tool could do the job better?
&g
ng it up.
>
> regards
> Steve
steve,
are you thinking about moveable python?
http://www.voidspace.org.uk/python/movpy/
bryan
--
http://mail.python.org/mailman/listinfo/python-list
lice type.
The '$' character works as in the PPEP above. It is undefined
outside square brackets, but that makes no real difference; the
programmer can use len(sequence).
This variant might break some tricky code.
--
--Bryan
--
http://mail.python.org/mailman/listinfo/python-list
res and
seemed to work well.
Now I've gotten off-topic. Threads are winning, and the industry
is going to multiple processors even for PC-class machines.
Might as well learn to use that power.
--
--Bryan
--
http://mail.python.org/mailman/listinfo/python-list
Donn Cave wrote:
> Bryan Olson wrote:
>>On a uniprocessor system, the GIL is no problem. On multi-
>>processor/core systems, it's a big loser.
>
>
> I rather suspect it's a bigger winner there.
>
> Someone who needs to execute Python instructions
flock.
Yes, sorry; my bad.
> Use file that is writeable by A and B in a directory that is
> writeable only by root.
Is that portable? What's the sequence the program should try?
--
--Bryan
--
http://mail.python.org/mailman/listinfo/python-list
ems, it's a big loser.
--
--Bryan
--
http://mail.python.org/mailman/listinfo/python-list
Peter Hansen wrote:
> Bryan Olson wrote:
>
>> Peter Hansen wrote:
>> > My question was in the context of the OP's situation. What
>> possible use
>> > for 1000 OS threads could he have?
>>
>> Is this a language thing? Surely you real
ed on
Windows and Linux in my not-so-extensive testing.
--
--Bryan
"""
Import this module into graphical Python apps to provide a
sys.stderr. No functions to call, just import it. It uses
only facilities in the Python standard distribution.
If nothing is eve
requirements, why not just ask him
about his requirements? Kind of premature to condemn his
approach.
--
--Bryan
--
http://mail.python.org/mailman/listinfo/python-list
Sheila King wrote:
> Bryan Olson wrote:
[...]
>>Under some older threading systems, any system call would block every
>>thread in the process, and gethostbyname was notorious for holding things
>>up. Some systems offer an asynchronous gethostbyname, but that doesn't
601 - 700 of 754 matches
Mail list logo