ed more to go on. From what you
write, I cannot 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 i
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
>
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 n
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
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 t
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
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
Adam Monsen wrote:
> The following script is a high-performance link ( href="...">...) 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'''
>
[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(), a
[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 inde
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
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.
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 t
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".
>
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. Example
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
> singl
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,
> wh
Steven D'Aprano wrote:
> On Thu, 05 Jan 2006 05:21:24 +0000, Bryan Olson wrote:
>
>
>>Steven D'Aprano wrote:
>>
>>>Mike Meyer wrote:
>>
>>[...]
>>
>>>>Correct. What's stored in a list is a reference.
>>>
>>
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 a
[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
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 qu
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 25
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:
>
>
>>>
[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
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 va
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.
&g
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."
Py
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 figu
Mike Meyer wrote:
> Bryan Olson <[EMAIL PROTECTED]> writes:
>
>>Mike Meyer wrote:
>>
>>>Bryan Olson <[EMAIL PROTECTED]> writes:
>>>
>>>>Mike Meyer wrote:
>>>>
>>>>>Bryan Olson writes:
>>>>The Pyth
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 distinc
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
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, b
Marco Meoni wrote:
> Hi. I read the Gordon McMillan's "Socket Programming Howto".
> I tried to use the example in this howto but this doesn't work.
You are right, that obviously won't work. The code passes
'self' to __init__, but not to any of the others methods.
I'm cc'ing this post to [EMAIL PR
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'''
>>
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 t
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 s
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 = {}
re
H J van Rooyen wrote:
[...]
> This is broadly what I had in mind, yes - but sort of down to
a transaction
> level - this user does invoicing, this one enters cheques,
this one does credit
> notes, and their supervisor can do all three, and in a
different department its
> different because th
Duncan Booth wrote:
> [EMAIL PROTECTED] wrote:
>
>> >From a WinXP command prompt:
>>
>> C:\>
>> C:\>cd /windows/system32
>>
>> C:\WINDOWS\system32>
>>
>>
> Not from my Windows XP command prompt it doesn't. Do you have anything
> strange installed on your system?
Tons of strange stuff
Christopher Weimann wrote:
> On 08/02/2006-08:06AM, [EMAIL PROTECTED] wrote:
>> From a WinXP command prompt:
>>
>> C:\>
>> C:\>cd /windows/system32
>>
>> C:\WINDOWS\system32>
>>
>>
>
>
> This doesn't work the way you think it does.
>
> C:\>cd /windows
>
> C:\WINDOWS>cd /system32
>
Duncan Booth wrote:
> Bryan Olson wrote:
>
>> Duncan Booth wrote:
>>> [EMAIL PROTECTED] wrote:
>>>
>>>> >From a WinXP command prompt:
>>>>
>>>> C:\>
>>>> C:\>cd /windows/system32
>>>>
>&g
Duncan Booth wrote:
> Bryan Olson wrote:
>
>> Not quite. The first slash is ambiguous and apparently ignored,
>> but latter slashes are taken as a path separators.
>
> I'm not sure ambiguity enters into it. I think perhaps the bad detection of
> the option ha
Duncan Booth wrote:
> Bryan Olson wrote:
>
>> Duncan Booth wrote:
>>> Any other Microsoft commands I try all complain about 'invalid
>>> switch'.
>>
>> The first I noticed were their build tools. Their version of
>> "make",
Carl Banks wrote:
> Ritesh Raj Sarraf wrote:
>> Carl Banks wrote:
>>> Then change the zipping part of download_from_web to acquire and
>>> release this lock; do zipfile operations only between them.
>>>
>>> ziplock.acquire()
>>> try:
>>> do_all_zipfile_stuff_here()
>>> finally:
>>> ziplock.
Ritesh Raj Sarraf wrote:
[...]
> I noticed that even though while one thread acquires the lock, the other
> threads
> don't respect the lock. In fact they just go ahead and execute the statements
> within the lock acquire statement. With this behavior, I'm ending up having a
> partially corrupted
Robin Haswell wrote:
> Hey there
>
> Soon we will have many squid proxies on many seperate connections for use
> by our services. I want to make them available to users via a single HTTP
> proxy - however, I want fine-grained control over how the squid proxies
> are selected for each connection. T
zxo102 wrote:
>I am doing a small project using socket server and thread in python.
> This is first time for me to use socket and thread things.
>Here is my case. I have 20 socket clients. Each client send a set
> of sensor data per second to a socket server. The socket server will
> do
2Good4You-Veki(Cro) wrote:
> when I want use python nntplib:
[...]
> error: (10053, 'Software caused connection abort')
That's not such a strange error; various network problems can
cause it. It means something went wrong with the TCP connection,
so your system aborted it.
Does it happen consist
[EMAIL PROTECTED] wrote:
> Hello,
> it is possible to stop all threads (application) from thread of
> application:
> App
> |-MainThread
> |-WebServer
> |-CmdListener # From this I want to stop App
>
> The sys.exit isn't working...
You can start all threads other than CmdListener as daemon
thr
SpreadTooThin wrote:
> Jean-Paul many thanks for this and your effort.
> but why is it every time I try to do something with 'stock' python I
> need another package?
Twisted has it's fan, but you don't "need" it. Your code had a few
specific problems, and fixing them has little or nothing to do wi
Blair P. Houghton wrote:
> But they do about 10 things totally wrong with Google groups that
> I'd've fixed in my spare time in my first week if they'd hired me back
> when I was interviewing with them.
>
> So if they want it to work, they know where to find me.
Doesn't seem likely, does it? But
Aahz wrote:
> The problem is the network effect. In this case, what Google has that
> can't be replicated is the history of posts.
There's no magic there. Get them the same way Google and
Dejanews got them, plus you might scrape Google, from some
locality with favorable laws.
--
--Bryan
--
ht
Blair P. Houghton wrote:
> Usenet isn't just the "send this message to all leaf nodes via tree"
> behavior,
> it's the "show me the message from 1987 or 1988 written by dickie
> sexton where
> he invents the '(*plonk*)' meme" behavior, and a lot of others.
That makes Google the only non-broken Use
Ben wrote:
> I have set up a dictionary into whose values I am putting a list. I
> loop around and around filling my list each time with new values, then
> dumping this list into the dictionary. Or so I thought...
>
> It would appear that what I am dumping into the dictionary value is
> only a poi
Roman Petrichev wrote:
> Hi folks.
> I've just faced with very nasty memory consumption problem.
> I have a multythreaded app with 150 threads
[...]
>
> The test app code:
>
>
> Q = Queue.Queue()
> for i in rez: #rez length - 5000
> Q.put(i)
>
>
> def checker():
> while True:
>
Dennis Lee Bieber wrote:
> How much stack space gets allocated for 150 threads?
In Python 2.5, each thread will be allocated
thread.stack_size()
bytes of stack address space. Note that address space is
not physical memory, nor even virtual memory. On modern
operating systems, the memo
Gabriel Genellina wrote:
> At Sunday 22/10/2006 20:31, Roman Petrichev wrote:
>
>> I've just faced with very nasty memory consumption problem.
>> I have a multythreaded app with 150 threads which use the only and the
>> same function - through urllib2 it just gets the web page's html code
>> and a
Snor wrote:
> I'm attempting to create a lobby & game server for a multiplayer game,
> and have hit a problem early on with the server design. I am stuck
> between using a threaded server, and using an event driven server. I've
> been told time and time again that I should use an event driven serve
Jean-Paul Calderone wrote:
> On Tue, 31 Oct 2006 07:33:59 GMT, Bryan Olson <[EMAIL PROTECTED]>
> wrote:
>> Snor wrote:
>>> I'm attempting to create a lobby & game server for a multiplayer game,
>>> and have hit a problem early on with the server de
Fredrik Lundh wrote:
> [...] besides, in all dictionaries I've consulted, the word "sum"
> means "adding numbers".
That's a result of not looking deeply enough.
Fredrik Lundh is partially right, in that "Sum" usually refers
to addition of numbers. Nevertheless, the idea that "sum" must
refer to n
Paul Rubin wrote:
> Are you saying "abc"+"def" should not be concatenation? I guess
> that's reasonable.
No, I'm definitely not saying that, or at least I didn't mean
that.
> As long as + is string concatenation though, the
> principle of least astonishment suggests that "sum" should
> conconca
KraftDiner wrote:
> Thanks I can't seem to get this example to do anything except sit
> there
> http://docs.python.org/lib/asyncore-example.html
Yeah, the example code, by itself, will just sit there.
As an example, it should probably include the calls to make it
do something. Try adding the
Amir Michail wrote:
> Trying to open a file for writing that is already open for writing
> should result in an exception.
>
> It's all too easy to accidentally open a shelve for writing twice and
> this can lead to hard to track down database corruption errors.
The right solution is file locking.
Paddy wrote:
> I've never done this in anger so feel free to mock (a little :-).
>
> I'd have a fixed field at the beginning of the field that can hold the
> hostname process number, and access time of a writing process, togeher
> with a sentinal value that means "no process has access to the file
Grant Edwards wrote:
> Amir Michail wrote:
>
>> Trying to open a file for writing that is already open for writing
>> should result in an exception.
>
> MS Windows seems to do something similar, and it pisses me off
> no end. Trying to open a file and read it while somebody else
> has it open f
Ben Cartwright wrote:
> The typical kludge is to wrap the variable in the outer function inside
> a mutable object, then pass it into the inner using a default argument:
>
> def outer():
> a = "outer"
> def inner(wrapa=[a]):
> print wrapa[0]
> wrapa[0] = "inner"
> retu
Ritesh Raj Sarraf wrote:
[...]
> Here's the function, download_from_web() which calls the progress bar:
> main.py
> def download_from_web(sUrl, sFile, sSourceDir, checksum):
[...]
> temp = urllib2.urlopen(sUrl)
> headers = temp.info()
> size = int(headers['Content-Length'])
Tal Einat wrote:
> Tim Chase wrote:
>> I'm not sure if '__iter__' is the right thing to be looking for,
>> but it seems to work at least for lists, sets, dictionarys (via
>> their keys), etc. I would use it because at least then you know
>> you can iterate over it
>
> AFAIK and as seen throughout
bayerj wrote:
> Then you can use POSH [1] to share data and objects.
Do you use POSH? How well does it work with current Python?
Any major gotchas?
I think POSH looks like a great thing to have, but the latest
version is an alpha from over three years ago. Also, it only
runs on *nix systems.
-
Paul Rubin wrote:
> "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes:
>> If it's read/write data or you're not on a Unix platform, you can use
>> shared memory to shared it between many processes.
>>
>> Threads are way overused in modern multiexecution programming. The
>> decision on whether to use
[EMAIL PROTECTED] wrote:
> Bryan Olson wrote:
>> I think it's even worse. The standard Python library offers
>> shared memory, but not cross-process locks.
>
> File locks are supported by the standard library (at least on Unix,
> I've not tried on Windows).
I wrote:
> Ah, O.K. Like Paul, I was unaware how Unix file worked with
> mmap.
Insert "locking" after "file".
--
--Bryan
--
http://mail.python.org/mailman/listinfo/python-list
hg wrote:
> I am writing a transaction server (socket-based) under windows.
>
> I use mysqldb to log info into MySQL.
>
> It is all working and I need now to decide whether to use forks
> (CreateProcess I guess) or threads.
>
> I saw in another thread that some db engines did have issues with be
[EMAIL PROTECTED] wrote:
> Bryan> MySQL has its own process. It doesn't know nor care whether your
> Bryan> application makes connections from different processes or
> Bryan> different threads in the same process.
>
> Yes, but on the client side the data structures may or may not be
>
Ben Sizer wrote:
> It's not a crackpot theory. It's a completely reasonable theory. SQL is
> based on relational algebra, which provides a mathematical set of
> operators for grouping data that is stored in separate sets. That data
> is selected and projected according to its value, and nothing els
[EMAIL PROTECTED] wrote:
> Bryan> Go with your gut. Python threads are reasonably portable, and
> Bryan> work well on modern MS-Windows.
>
> >> Maybe ignore your gut and read the documentation. ;-)
>
> Bryan> What in the documentation do you think answers the question?
>
> The pa
Saizan wrote:
[...]
> I tried sock.settimeout(10) before entering the while and so checking
> timeout exception on accept() but I experienced a strange behavior, the
> clients connections close immediatly, with one of these exceptions on
> the client side on their first use of the rpc connection:
[
Licheng Fang wrote:
> Oh, please do have a look at the second link I've posted. There's a
> table comparing the regexp engines. The engines you've tested probably
> all use an NFA implementation.
Unfortunately, the stuff about NFA's is wrong. Friedl's awful
book was the first time I saw this confu
Tim Peters wrote:
> [Bryan Olson]
>> Unfortunately, the stuff about NFA's is wrong. Friedl's awful
>> book
>
> Strongly disagree: [...]
I know I'm disagreeing with a lot of smart people in panning
the book.
>> What Python uses is search-and-backtrack
Licheng Fang wrote:
> Basically, the problem is this:
>
p = re.compile("do|dolittle")
p.match("dolittle").group()
> 'do'
>
> Python's NFA regexp engine trys only the first option, and happily
> rests on that. There's another example:
>
p = re.compile("one(self)?(selfsufficient)?")
Tim Peters wrote:
> [...] The most valuable general technique he (eventually ;-)
> explained he called "unrolling", and consists of writing a regexp in
> the form:
>
>normal* (?: special normal* )*
>
> where the sets of characters with which `normal` and `special` can
> start are disjoint.
Licheng Fang wrote:
> Basically, the problem is this:
>
p = re.compile("do|dolittle")
p.match("dolittle").group()
> 'do'
>
> Python's NFA regexp engine trys only the first option, and happily
> rests on that. There's another example:
>
p = re.compile("one(self)?(selfsufficient)?")
Ben Sizer wrote:
> Bryan Olson wrote:
>> Ben Sizer wrote:
>>> It's not a crackpot theory. It's a completely reasonable theory. SQL is
>>> based on relational algebra, which provides a mathematical set of
>>> operators for grouping data that is stored i
Diez B. Roggisch wrote:
> bmearns schrieb:
>> Is it possible to specify which port to use as the outbound port on a
>> connection?
[...]
>> Specifically, I'm trying to write an FTP host, and I'm trying to
>> implement the PORT command.
>
> AFAIK you neither can't do that nor need it.
It's not t
Paul McGuire wrote:
> "Carl J. Van Arsdall" wrote:
>> Basically I used the datetime module and timedelta objects to calculate a
>> difference between two times. Now I'm trying to figure out how I make
>> that time delta a string HH:MM:SS to show elapsed time.
[...]
> From the Python console:
>
Hugh wrote:
> Sorry, here's an example...
>
> 5+7=12
>
> added without carrying, 5+7=2
>
> i.e the result is always less than 10
Are you looking for bitwise exclusive or? In Python it's
the '^' operator. For example:
print 5 ^ 7
--
--Bryan
--
http://mail.python.org/mailman/listinfo/py
Bruno Desthuilliers wrote:
> Bryan Olson wrote:
>> Hugh wrote:
>>> Sorry, here's an example...
>>>
>>> 5+7=12
>>>
>>> added without carrying, 5+7=2
>>>
>>> i.e the result is always less than 10
>> Are yo
Grant Edwards wrote:
> Diez B. Roggisch wrote:
[Bryan Olson had written:]
>>> It's not the issue here, but to specify the outgoing port
>>> call bind(('', portnum)) before connect().
>> I wasn't aware of that. Cool.
>
> It's an interesti
Steve Holden wrote:
> Grant Edwards wrote:
>>> Well, one of ftpd implementations I have here (C code from RTEMS) does
>>> this:
>>>
>>> /* anchor socket to avoid multi-homing problems */
>>> data_source = info->ctrl_addr;
>>> data_source.sin_port = htons(20); /* ftp-data port */
>>>
Calvin Spealman wrote:
> I repeat this all the time, but the best advice I can give you about
> using threads is to not use threads at all.
Might as well get with the times and ignore that advice.
> I would point you to good
> references like Threads Considered Harmful
> (http://www.kuro5hin.org/
Bjoern Schliessmann wrote:
> Christophe wrote:
>
>> To be exact, you need a 64bit Windows OS on a 64bit cpu.
>
> Is there a reason that can be explained in a less-than-2-KB
> posting? :) I mean why Python depends on the processor type that
> much.
The 64-bit version of Python is compiled for 64-
Stéphane Ninin wrote:
> I have a few questions regarding sockets with timeouts.
>
> Assuming you set a timeout t on a socket s and then call:
>
>
> 1) s.sendall
> Is the socket.timeout exception thrown when
> not the data was sent in the given time t
> or if nothing was sent ?
Neither; not exa
Stéphane Ninin wrote:
> Yes, I typed it *really* too fast, it would be more something like this:
>
> def sendall(self, data):
> while data:
> try:
> n = self.request.send(data)
> data = data[n:]
> except socket.timeout, e:
>
daniel wrote:
> Can anyone explain the main points in working with threads in Python.
They are system threads, so the main points are much like in
other languages. Examine how thread.lock works, and look up the
queue module.
> Why use threading and not Thread.
There's no reason not to use thread
Stéphane Ninin wrote:
> I want to make sure that, if nothing is sent after some time,
> if event "terminated" is set,
> then the thread doesnot spend more time trying to send something which
> has become useless.
You should be good then. The timeout is on each send(), and send
times out if and o
efrat wrote:
> I'm planning to use Python in order to teach a DSA (data structures
> and algorithms) course in an academic institute. If you could help out
> with the following questions, I'd sure appreciate it:
> 1. What exactly is a Python list?
It's almost exactly what the doc says (and exa
Paul Rubin wrote:
> Is there any way to get Python to release memory back to the
> C allocator? I'm currently running a script that goes through
> the following steps:
>
> 1) Creates a very large number of Python objects to produce
> a relatively small data structure that sits
OneMustFall wrote:
> Reciently i wrote a simple client (in twisted) using Reconnecting
> Factory.
> That client logins to my socket server.. and that`s it.
>
> Interesting thing is that it is seems that twisted client,
> sends some ping on a TCP level without sending any da
101 - 200 of 371 matches
Mail list logo