Atanas Banov wrote:
Bryan Olson wrote:
To get it with the \, you might use:
os.path.abspath(os.environ['SYSTEMDRIVE'])
wrong!
the result is incorrect if the current directory is different from the
root.
Oops, sorry. I should know better than to code from what I
think I vaguely
Farshid Lashkari wrote:
When I pass an empty string to a function is a new string object created
or does python use some global pre-created object? I know python does
this with integer objects under a certain value. For instance, in the
following code is a new string object created for each
[EMAIL PROTECTED] wrote:
thread1:
while 1:
buf = s.read()
process(buf)
thread2:
while 1:
buf = getdata()
s.write(buf)
Sockets don't have read() and write() methods. Connected
sockets have recv() and send()/sendall(). Python's socket
module has a
Carl J. Van Arsdall wrote:
Steve Horsley wrote:
[EMAIL PROTECTED] wrote:
thread1:
while 1:
buf = s.read()
process(buf)
thread2:
while 1:
buf = getdata()
s.write(buf)
It is safe, but watch out for this gotcha: If thread B calls
rtilley wrote:
Carsten Haese wrote:
Is there a reason why os.environ['SYSTEMDRIVE'] shouldn't work?
I didn't know it was in os! It returns C: instead of C:\ like my method.
Other than that, it seems to do the trick.
To get it with the \, you might use:
Magnus Lycka wrote:
Bryan Olson wrote:
Magnus Lycka wrote:
Do you really have a usecase for this? It seems to me that your
argument is pretty hollow.
Sure:
if item_triggering_end in collection:
handle_end(whatever)
collection.clear()
Or maybe moving everything
Raymond Hettinger wrote:
[...]
If you're asking why list's don't have a clear() method, the answer is
that they already had two ways to do it (slice assignment and slice
deletion) and Guido must have valued API compactness over collection
polymorphism.
That's a decision from long ago. Now
Magnus Lycka wrote:
Bryan Olson wrote:
Magnus Lycka wrote:
Bryan Olson wrote:
big_union = set()
for collection in some_iter:
big_union.update(t)
collection.clear()
I don't understand the second one. Where did 't' come from?
Cut-and-past carelessness. Meant
Rene Pijlman wrote:
Carl J. Van Arsdall:
I've been toying with threads a lot lately and I've noticed that if a
scripting error occurs in a thread the thread dies, but not the process
that spawned the thread.
Is python supposed to behave this way or is this type of behavior
accidental?
Magnus Lycka wrote:
Bryan Olson wrote:
The original question was about idioms and understanding, but
there's more to the case for list.clear. Python is duck typed.
Consistency is the key to polymorphism: type X will work as an
actual parameter if and only if X has the required methods
Magnus Lycka wrote:
Ed Singleton wrote:
The point is that having to use del to clear a list appears to the
inexperienced as being an odd shaped brick when they've already used
the .clear() brick in other places.
Agreed. The smart way to go from this stage of surprise is
not to assume
Fredrik Lundh wrote:
Steven D'Aprano wrote:
[...]
del L[:] works, but unless you are Dutch, it fails the
obviousness test.
unless you read some documentation, that is. del on sequences
and mappings is a pretty fundamental part of Python. so are slicings.
So is consistency; it ain't Perl,
Alan Morgan wrote:
slogging_away wrote:
Hi - I'm running Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310
32 bit (Intel)] on win32, and have a script that makes numerous checks
on text files, (configuration files), so discrepancies can be reported.
The script works fine but it appears that
Fredrik Lundh wrote:
Bryan Olson wrote:
So is consistency; it ain't Perl, thank Guido.
consistency is the hobgoblin of little minds.
Look up that saying. Any clues?
Python now has, what, three built-in mutable collections types:
lists, dictionaries, and sets. Dicts and sets both have
Terry Reedy wrote:
Bryan Olson wrote:
I made a script with 100,000 if's, (code below) and it appears
to work on a couple systems, including Python 2.4.2 on Win32-XP.
So at first cut, it doesn't seem to be just the if-count that
triggers the bug.
The OP did not specify whether all of his
Tuvas wrote:
The stuff that it runs aren't heavily processor intensive, but rather
consistant. It's looking to read incoming data. For some reason when it
does this, it won't execute other threads until it's done. Hmmm.
Perhaps I'll just have to work on a custom read function that doesn't
Peter Hansen wrote:
Ivan Voras wrote:
Python is bad for concurrently executing/computing threads, but it
shouldn't be that bad - do you have lots of compute-intensive threads?
Just in case anyone coming along in the future reads this statement, for
the record I'd like to say this is
Tuvas wrote:
The read function used actually is from a library in C, for use over a
CAN interface. The same library appears to work perfectly find over C.
[...]
When nothing is happening, the thread runs pretty consistantly at 1
second. However, when it is doing IO through this C function or
Lee Leahu wrote:
I am trying to write a simple threaded application which will
simulate 1000 connections to a remote service in order to
stress test that the remote service can handle that many
connections.
That shouldn't be a problem on a modern OS, but there are
still quite a few
le dahut wrote:
I have a server that receives data from a client, detect the end of this
data and send other data back to the client (it's to measure bandwidth).
I think the best way is to thread a part of the server's program am I
right ?
Others disagree on this, but in most cases, yes:
Christoph Zwerschke wrote:
Bryan Olson wrote:
The claim everything is a set falls into the category of
'not even wrong'.
No, it falls into the category of the most fundamental Mathematical
concepts. You actually *define* tuples as sets, or functions as sets or
relations as sets
le dahut wrote:
I've read the Gordon McMillan's Socket Programming HOWTO
Just a few days ago, another participant in this group noted
that code in Gordon McMillan's Socket Programming HOWTO
does not work. He was right. The code is wrong.
Currently, one can Google up Python socket howto, and
Christoph Zwerschke wrote:
[...]
That may be the main problem to decide whether the cartesian product
should return a generator or a list.
The Cartesion product is a set.
[...]
That's the other problem. The uses cases (like the password cracker
example) are very limited and in these cases
Steven D'Aprano wrote:
Bryan Olson wrote:
Christoph Zwerschke wrote:
[...]
That may be the main problem to decide whether the cartesian product
should return a generator or a list.
The Cartesion product is a set.
And the generalization of mathematical sets in Python can be built-in
sets
Steven D'Aprano wrote:
Bryan Olson wrote:
[Christoph Zwerschke had written:]
What I expect as the result is the cartesian product of the strings.
There's no such thing; you'd have to define it first. Are duplicates
significant? Order?
Google cartesian product and hit I'm feeling lucky
Steven D'Aprano wrote:
On Mon, 23 Jan 2006 18:17:08 +, Bryan Olson wrote:
Steven D'Aprano wrote:
Bryan Olson wrote:
[Christoph Zwerschke had written:]
What I expect as the result is the cartesian product of the strings.
There's no such thing; you'd have to define it first
Kay Schluehr wrote:
Bryan Olson wrote:
There's no such thing; you'd have to define it first. Are duplicates
significant? Order?
That's all trivial isn't it? A string is a set of pairs (i,c) where i
is an integer number, the index, with 0=ij=card(string)-1, for
(i,c), (j,d) in string
Bryan Olson wrote:
Duncan Booth wrote:
Here's the way I would do it:
def occurrences(it):
res = {}
for item in it:
if item in res:
res[item] += 1
else:
res[item] = 1
return res
I slightly prefer:
def occurrences
Christoph Zwerschke wrote:
Bryan Olson schrieb:
Still think there is no such thing?
Uh, yes.
The Cartesian product of two sets A and B (also called the
product set, set direct product, or cross product) is defined to
be the set of [...]
All sets, no strings. What were you
Christoph Zwerschke wrote:
In Python, it is possible to multiply a string with a number:
hello*3
'hellohellohello'
Which is really useful.
However, you can't multiply a string with another string:
'hello'*'world'
Traceback (most recent call last):
File interactive input, line 1,
Roy Smith wrote:
[EMAIL PROTECTED] wrote:
I have a regular expression that is approximately 100k bytes. (It is
basically a list of all known norwegian postal numbers and the
corresponding place with | in between. I know this is not the intended
use for regular expressions, but it should
Duncan Booth wrote:
Here's the way I would do it:
def occurrences(it):
res = {}
for item in it:
if item in res:
res[item] += 1
else:
res[item] = 1
return res
I slightly prefer:
def occurrences(it):
res = {}
res[item] =
Kay Schluehr wrote:
I want to manipulate a deeply nested list in a generic way at a
determined place. Given a sequence of constant objects a1, a2, ..., aN
and a variable x. Now construct a list from them recursively:
L = [a1, [a2, [[aN, [x]]...]]
The value of x is the only one to be
I mis-phrased:
The code passes
'self' to __init__, but not to any of the others methods.
Of course I meant that the formal parameter for self is missing.
class mysocket:
'''classe solamente dimostrativa
- codificata per chiarezza, non per efficenza'''
def
Kevin wrote:
The best way to do this is by using a flag or event that the child-threads
monitor each loop (or multiple times per loop if it's a long loop). If the
flag is set, they exit themselves.
The parent thread only has to set the flag to cause the children to die.
Doesn't work,
Mike Meyer wrote:
Bryan Olson [EMAIL PROTECTED] writes:
Mike Meyer wrote:
Bryan Olson [EMAIL PROTECTED] writes:
Mike Meyer wrote:
Bryan Olson writes:
The Python manual's claim there is solidly grounded. The logic
of 'types' is reasonably well-defined in the discipline. Each
instance
Fredrik Lundh wrote:
Bryan Olson wrote:
I think the following is correct: an object's identity is not part
of its value, while its type is.
you're wrong. an object's identity, type, and value are three different
and distinct things.
If I do:
mylist = [17, 24]
are mylist and 17
Mike Meyer wrote:
[...]
Actually, what data type implies to me is that data have a type. But
skip that for now - what's the data that goes along with an instance
of object?
Again, I'm not an expert on 'object'. When a type has
a single value instances can take, the value is simply
defined as
Fredrik Lundh wrote:
You're comparing identities, not values. The value is the set of things that
you can access via an object's methods (via the type).
Which does make '==' kind of weird. It may or may not refer to
a method of the object.
The identity is not,
in itself, a part of the
Fredrik Lundh wrote:
Bryan Olson wrote:
The identity is not, in itself, a part of the value.
Python doesn't query the object to determine it's type or identity, but it
always has to query the object to access the value.
A look at the C implementation of a typical object might help
iclinux wrote:
a. how to exit the whole process in a thread?
b. when thread doing a infinite loops, how to terminate the process?:
As others noted, the threading module offers Thread.setDaemon.
As the doc says: The entire Python program exits when no active
non-daemon threads are left.
Mike Meyer wrote:
Bryan Olson [EMAIL PROTECTED] writes:
Mike Meyer wrote:
Bryan Olson writes:
[EMAIL PROTECTED] wrote:
The reason is that I am still trying to figure out
what a value is myself. Do all objects have values?
Yes.
Can you justify this, other than by quoting the manual whose
Mike Meyer wrote:
Bryan Olson writes:
[EMAIL PROTECTED] wrote:
The reason is that I am still trying to figure out
what a value is myself. Do all objects have values?
Yes.
Can you justify this, other than by quoting the manual whose problems
caused this question to be raised
Tim Chase wrote:
While working on a Jumble-esque program, I was trying to get a string
into a character array. Unfortunately, it seems to choke on the following
import random
s = abcefg
random.shuffle(s)
returning
File /usr/lib/python2.3/random.py, line 250, in shuffle
Sybren Stuvel wrote:
Mike Meyer enlightened us with:
I think type 'object' has only one value, so that's it.
In that case, they should all be equal, right?
object() == object()
False
You compare instances of the type 'object'. They both have one value:
object()
object object at
[EMAIL PROTECTED] wrote:
To your question of why you'd ever [recv(0)].
This is very common in any network programming. If you send a packet
of data that has a header and payload, and the header contains the
length (N) of the payload, then at some point you have to receive N
bytes. If N is
[EMAIL PROTECTED] wrote:
The reason is that I am still trying to figure out
what a value is myself. Do all objects have values?
Yes.
If
not which do and which don't? What's the value of int(1)?
An object? Some otherwise unreachable thing that
represents the abstract concept of the
Steven D'Aprano wrote:
On Thu, 05 Jan 2006 05:21:24 +, Bryan Olson wrote:
Steven D'Aprano wrote:
Mike Meyer wrote:
[...]
Correct. What's stored in a list is a reference.
Nonsense. What is stored in the list is an object.
According to the Python Language Reference:
Some objects
Steven D'Aprano wrote:
Bryan Olson wrote:
Wrong. C does not have references, and the Python use is consistent
with the rest of computer science. You seem to have read in things
that it does not mean. Fix *your* thinking.
Bryan, I'll admit that I'm no C/C++ programmer, and I frequently assume
Steven D'Aprano wrote:
Mike Meyer wrote:
[...]
Correct. What's stored in a list is a reference.
Nonsense. What is stored in the list is an object.
According to the Python Language Reference:
Some objects contain references to other objects; these are
called containers. Examples of
Mike Meyer wrote:
Steven D'Aprano writes:
[...]
Because the Original Poster said so! He said, to paraphrase, Hey, I
thought Python was call by reference, but I tried this, and it didn't
work, what gives???
And he's right, and you're wrong. Look at the *code*. There isn't a
single call in
Roy Smith wrote:
LOL, and you'll be LOL too when you see the problem :-)
You can't give the re.I flag to reCompiled.match(). You have to give
it to re.compile(). The second argument to reCompiled.match() is the
position where to start searching. I'm guessing re.I is defined as 2,
which
Tuvas wrote:
I have an image that is in a raw format, ei, no place markers to tell
the dimensions, just a big group of numbers.
The adjective raw, apt as it may be, is a long way from specifying
the representation of an image. *Every* digital format is just a big
group of numbers.
I happen
Scott David Daniels wrote:
I've just put together a Double-Ended Heap package.
Of course I'd love comments.
http://members.dsl-only.net/~daniels/deheap.html
I think there's a typo in:
Note that any change to the contents of a DeHeap (and
therefore a DeHeap2) any re-arrange the
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, 2005.
# This module is free software
Skink wrote:
[...]
what's wrong here?
Sion Arrowsmith is right about what causes the delay.
Just in case your real code looks like this, I'll note:
len, = struct.unpack(!i, s.recv(4))
data = s.recv(len)
First, you almost certainly don't want to use the name 'len'.
Ought not to be
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(os.urandom)
--
--Bryan
--
http://mail.python.org/mailman/listinfo/python-list
Robby Dermody wrote:
[...] However, on a
simulated call center environment (constant 50 conversations, switching
every 300 seconds) the director component still consumes an average of
1MB more per hour and the harvester is taking an average of 4MB more per
hour. With the director, 2/3 of
Though I tried to submit a (pre-) PEP in the proper form through the proper
channels, it has disappeared into the ether.
In building a class that supports Python's slicing interface,
http://groups.google.com/group/comp.lang.python/msg/8f35464483aa7d7b
I encountered a Python bug, which,
Lasse Vågsæther Karlsen wrote:
I have a list of items and a rule for ordering them.
Unfortunately, the rule is not complete so it won't define the correct
order for any two items in that list.
This is called a partial ordering.
[...]
If there isn't anything built in, does anyone have
Peter Hansen wrote:
Gopal wrote:
[...] I'm
thinking of going with this format by having Param Name - value. Note
that the value is a string/number; something like this:
PROJECT_ID = E4208506
SW_VERSION = 18d
HW_VERSION = 2
In my script, I need to parse this config file and
Steven D'Aprano wrote:
Or wait, I have thought of one usage case: if you are returning a value
that you know will be used only as a flag, you should convert it into a
bool. Are there any other uses for bool()?
We could, of course, get along without it. One use for
canonical true and false
Tuvas wrote:
Anyone know a module that does CRC16 for Python? I have an aplication
that I need to run it, and am not having alot of sucess. I have a
program in C that uses a CRC16 according to CCITT standards, but need
to get a program that tests it with python as well. Thanks!
I'll include
ed wrote:
this script should create individual threads to scan a range of IP
addresses, but it doesnt, it simple ... does nothing. it doesnt hang
over anything, the thread is not being executed, any ideas anyone?
It's because of the bugs. Nothing happens because
threading MAX_THREADS
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.
I hereby retract that assertion of my post.
--
--Bryan
Maurice LING wrote:
Hi,
I just have a simple question about threads. My classes inherits from
threading.Thread class. I am calling threading.Thread.run() method to
spawn a few threads to parallel some parts of my program. No thread
re-use, pooling, joining ... just plainly spawn a
[EMAIL PROTECTED] wrote:
Hi again,
Since my linear algebra library appears not to serve any practical
need (I found cgkit, and that works better for me), I've gotten bored
and went back to one of my other projects: reimplementing the Python
builtin classes list(), set(), dict(), and
[EMAIL PROTECTED] wrote:
Here overhead is compared to a C array of 1 million PyObject *s.
Thus, on average, a 1 million element B-tree uses 25% less memory
than any other balanced data structure which I am aware of, and 50%
more memory than a raw C array.
That's overhead of indexing;
Steve M wrote:
[...]
1. Based on your description, don't trust the client. Therefore,
security, whatever that amounts to, basically has to happen on the
server.
That's the right answer. Trying to enforce security within your
software running the client machine does not work. Forget the
bruno modulix wrote:
Frank Millman wrote:
I am writing a multi-user accounting/business system. Data is stored in
a database (PostgreSQL on Linux, SQL Server on Windows). I have written
a Python program to run on the client, which uses wxPython as a gui,
and connects to the database via
Adam Monsen wrote:
The following script is a high-performance link (a
href=../a) extractor. [...]
* extract links from text (most likey valid HTML)
[...]
import re
import urllib
whiteout = re.compile(r'\s+')
# grabs hyperlinks from text
href_re = re.compile(r'''
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 languages on such low-level code.
I'd bet
tell where it fails, nor even what submission is
yours and your latest.
--
--Bryan
#!/user/bin/env python
Python solution to:
http://spoj.sphere.pl/problems/SUPPER/
By Bryan Olson
from sys import stdin
def one_way(seq):
n = len(seq)
dominators = [n + 1] * (n
n00m wrote:
[...]
Btw, the newest oops in the topic's subject is:
the code does not work in the case of:
sqls_host, sqls_port = '192.168.0.8', 1433
proxy_host, proxy_port = '192.168.0.3', 1434
## proxy_host, proxy_port = '127.0.0.1', 1434
## proxy_host, proxy_port = '', 1434
I.e.
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 respect to my code, you
n00m wrote:
Oh!
Seems you misunderstand me!
See how the last block in your code should look:
for tc in range(10):
_ = stdin.readline()
sequence = [int(ch) for ch in stdin.readline().split()]
supers = supernumbers(sequence)
print len(supers)
for i in supers:
n00m wrote:
It also timed out:(
Could be. Yet you did write:
It's incredibly fast!
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 languages on such low-level code.
I'd bet money that
Paul Rubin wrote:
To get even more OS-specific, AF_UNIX sockets (at least on Linux) have
a feature called ancillary messages that allow passing file
descriptors between processes. It's currently not supported by the
Python socket lib, but one of these days... . But I don't think
Windows has
n00m wrote:
Firstly I find ordering numbers when moving from left to the right;
then I find ord. numbers for backward direction AND for DECREASING
subsequences:
Sounds good.
Btw, I did it in Pascal. Honestly, I don't believe it can
be done in Python (of course I mean only the imposed
Phill Atwood wrote:
[...]
So how do I add a dictionary into a list by value rather than
by reference?
Is rec.items() what you want? It returns a list of (key, value)
tuples.
The complete code is here:
[...]
Looks like you could use Python's ConfigParser module.
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
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.
--
--Bryan
--
Alex Le Dain wrote, in entirety:
What is the best way to access a Pervasive database on another machine?
The best way, is, well ... Pervasively!
Sorry. I can be kida a jerk like that.
People often do get get hundreds, sometimes thousands of dollars worth
of consultation from these groups, for
Jacek Poplawski had written:
I am going to write python script which will read python
command from socket, run it and return some values back to
socket.
My problem is, that I need some timeout.
Jacek Poplawski wrote:
After reading more archive I think that solution may be to raise an
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 will hence forth
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.)
--
--Bryan
--
Reinhold Birkenfeld wrote:
tiissa wrote:
bill wrote:
From 3.2 in the Reference Manual The Standard Type Hierarchy:
Integers
These represent elements from the mathematical set of whole
numbers.
The generally recognized definition of a 'whole number' is zero and the
positive
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.html
So maybe:
Integers
n00m wrote:
Your last version works like a champ. It easily handles up
to 5 instances of my.vbs! Except of this thing:
AttributeError: 'module' object has no attribute 'SHUT_WR'
Seems it's a pure Unix constant.
No, my guess is that you're running an old version of Python.
The constant
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?
Yes, but that's when it went into the source
Dennis Lee Bieber wrote:
I'm going to go back a few messages... Looking for a
simplification...
[...]
TWO threads, both just infinite loops of the same nature (you could
actually have done ONE def and passed different arguments in to
differentiate the two thread invocations.
I wrote:
Below is a version that respects ^C to terminate
more-or-less cleanly.
Oops, one more bug^H^H^H improvement. I forgot to shutdown
writing.
import socket, threading, select
sqls_host, sqls_port = '192.168.0.3', 1443
proxy_host, proxy_port = '', 1434
def
n00m wrote:
My today's tests (over LAN).
I think *it* will drive me mad very soon.
Conflicting results snipped
Network programming is like that. Just because something worked
once doesn't mean it really works. I had guessed two causes for
the behavior you were seeing, and either could result
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 Microsoft's
Win32 threads (on NT or better). Some
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 anything. Python 2.4 did.
False. ;) That was all you.
let's see what
Python 2.2 has to say about this:
$ python2.2
Norm Goertzen wrote:
I've posted a previous question about IDEs [...]
Python is a fine scripting language; it isn't centered on a
particular IDE, and doesn't really serve the same market as
Powerbuilder. Building an app in Python is a far lower-level
process than building one in Powerbuilder,
Dennis Lee Bieber wrote:
Well, at that point, you could substitute waiting on a queue with
waiting on a socket and still have the same problem -- regardless of
the nature of the language/libraries for threading; it's a problem with
the design of the classes as applied to a threaded
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 to terminate
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 provide isn't as managable
as the one
Paul Rubin wrote:
Not every sequence needs __len__; for example, infinite sequences, or
sequences that implement slicing and subscripts by doing lazy
evaluation of iterators:
digits_of_pi = memoize(generate_pi_digits()) # 3,1,4,1,5,9,2,...
print digits_of_pi[5] # computes 6
201 - 300 of 362 matches
Mail list logo