Re: idiomatic analogue of Perl's: while (<>) { ... }

2011-08-31 Thread Peter Otten
Sahil Tandon wrote: > I've been tasked with converting some programs from Perl -> Python, and > am (as will soon be obvious) new to the language. A few archive/google > searches were inconclusive on a consensus approach, which is OK, but I > just wonder if there is a more Python-esque way to do t

Re: idiomatic analogue of Perl's: while (<>) { ... }

2011-08-31 Thread Steven D'Aprano
On Thu, 1 Sep 2011 02:56 pm Sahil Tandon wrote: > I've been tasked with converting some programs from Perl -> Python, and > am (as will soon be obvious) new to the language. A few archive/google > searches were inconclusive on a consensus approach, which is OK, but I > just wonder if there is a m

Re: How to daemonize a HTTPServer

2011-08-31 Thread Kushal Kumaran
On 1 Sep 2011 08:54, "babbu Pehlwan" wrote: > > I have written a http server using BaseHTTPServer module. Now I want > to instantiate it through another python script. The issue here is > after instantiate the control doesn't come back till the server is > running. Please suggest. What did a web

idiomatic analogue of Perl's: while (<>) { ... }

2011-08-31 Thread Sahil Tandon
I've been tasked with converting some programs from Perl -> Python, and am (as will soon be obvious) new to the language. A few archive/google searches were inconclusive on a consensus approach, which is OK, but I just wonder if there is a more Python-esque way to do the following in Python 2.7.1:

Re: try... except with unknown error types

2011-08-31 Thread John Nagle
On 8/21/2011 5:30 PM, Steven D'Aprano wrote: Chris Angelico wrote: A new and surprising mode of network failure would be indicated by a new subclass of IOError or EnvironmentError. /s/would/should/ I don't see why you expect this, when *existing* network-related failures aren't: import so

How to daemonize a HTTPServer

2011-08-31 Thread babbu Pehlwan
I have written a http server using BaseHTTPServer module. Now I want to instantiate it through another python script. The issue here is after instantiate the control doesn't come back till the server is running. Please suggest. -- http://mail.python.org/mailman/listinfo/python-list

Re: Why do class methods always need 'self' as the first parameter?

2011-08-31 Thread Chris Torek
In article <4e5ed670$0$29981$c3e8da3$54964...@news.astraweb.com> Steven D'Aprano wrote: >Er, yes, just like I suggested in my opening paragraph, and as I answered >following the bit you marked as snipped :) Oops, so you did (went back and re-read it). Must have gotten interrupted and lost track

Help required accessing dictionary

2011-08-31 Thread mrinalini
Hi I need to access the dictionary of the script that I am running through my vc++ application by embedding python. I am linking to python dynamically. I want to obtain the dictionary of the script and access the variables declared in the script. However, with the PyObject * that I get from the d

Re: Why do class methods always need 'self' as the first parameter?

2011-08-31 Thread Eric Snow
On Wed, Aug 31, 2011 at 7:47 PM, Chris Angelico wrote: > On Thu, Sep 1, 2011 at 10:48 AM, Steven D'Aprano > wrote: >> Python classes have a lot of dynamism made possible by the fact that methods >> are just wrappers around functions with an explicitly declared "self". That >> dynamism is rarely u

Re: Why do class methods always need 'self' as the first parameter?

2011-08-31 Thread Chris Angelico
On Thu, Sep 1, 2011 at 10:48 AM, Steven D'Aprano wrote: > Python classes have a lot of dynamism made possible by the fact that methods > are just wrappers around functions with an explicitly declared "self". That > dynamism is rarely used, but not *that* rarely, and is very useful when > used. Imp

Re: Handling 2.7 and 3.0 Versions of Dict

2011-08-31 Thread Travis Parks
On Aug 31, 7:37 pm, Gregory Ewing wrote: > Ian Kelly wrote: > > if sys.version_info < (3,): > >     getDictValues = dict.itervalues > > else: > >     getDictValues = dict.values > > > (which is basically what the OP was doing in the first place). > > And which he seemed to think didn't work for so

Re: PC locks up with list operations

2011-08-31 Thread Tim Chase
On 08/31/11 18:31, Gregory Ewing wrote: The Python process should also be able to set its own limits using resource.setrlimit(). A new corner of stdlib that I've never poked at. Thanks for the suggestion. Disappointed though that it doesn't seem to have docstrings on the functions, so I had

Re: Why do class methods always need 'self' as the first parameter?

2011-08-31 Thread Steven D'Aprano
Chris Torek wrote: >>There are also static methods, which don't receive any special first >>argument, plus any other sort of method you can invent, by creating >>descriptors... but that's getting into fairly advanced territory. ... > [rest snipped] > > I am not sure whether T. Goodchild was askin

Re: fun with nested loops

2011-08-31 Thread Steven D'Aprano
Chris Angelico wrote: > Ah well, was worth a try. Raising exceptions smells wrong for this, > but peppering your code with sentinel checks isn't much better. I > don't really know what would be a good solution to this... except > maybe this, which was proposed a few years ago and which I'd never >

Re: fun with nested loops

2011-08-31 Thread Steven D'Aprano
Daniel wrote: > And I have to keep the code simple for non CS people to run > the actual experiment. Do you think the software in the Apple iPod is "simple"? Or Microsoft Windows? No. You need to keep the *interface* simple. The internal details can be as complicated as they are needed to be. Sa

Re: Handling 2.7 and 3.0 Versions of Dict

2011-08-31 Thread Gregory Ewing
Ian Kelly wrote: if sys.version_info < (3,): getDictValues = dict.itervalues else: getDictValues = dict.values (which is basically what the OP was doing in the first place). And which he seemed to think didn't work for some reason, but it seems fine as far as I can tell: Python 2.7 (

Re: PC locks up with list operations

2011-08-31 Thread Gregory Ewing
Steven D'Aprano wrote: As far as I know, ulimit ("user limit") won't help. It can limit the amount of RAM available to a process, but that just makes the process start using virtual memory more quickly. ulimit -v is supposed to set the maximum amount of virtual memory the process can use. It

Re: Why do class methods always need 'self' as the first parameter?

2011-08-31 Thread Terry Reedy
On 8/31/2011 1:12 PM, Prasad, Ramit wrote: def double(obj): return 2*obj.value class C: def __init__(self, val): >> self.value = val c = C(3) >> C.double = double >> c.doub = double >> # not c.double as that would mask access to C.double in c.double() >> print(double(c), C.double(c)

Re: Closures and Partial Function Application

2011-08-31 Thread Terry Reedy
On 8/31/2011 12:45 PM, Travis Parks wrote: I was a little disappointed the other day when I realized that closures were read-only. 'Were', in 2.x. The standard 2.x workaround for a single nonlocal is to wrap it in a list. def f(): i = [0] def g(): i[0] += 1 for j in range(5): g()

Re: Subclassing str object

2011-08-31 Thread Ian Kelly
2011/8/31 Yaşar Arabacı : > @Ian: Thanks for you comments. I indeed didn't need the _sozcuk attribute at > all, so I deleted it. My class's addition and multiplication works without > overwriting __add__ and __mul__ because, this class uses unicode's __add__ > and __mul__ than creates a new kelime

Re: Why no warnings when re-assigning builtin names?

2011-08-31 Thread Seebs
On 2011-08-31, Chris Torek wrote: > (I realize this thread is old. I have been away for a few weeks. > I read through the whole thread, though, and did not see anyone > bring up this one particular point: there is already a linting > script that handles this.) Yes. I've found pylint... A weird

Re: Why do class methods always need 'self' as the first parameter?

2011-08-31 Thread Ian Kelly
On Wed, Aug 31, 2011 at 11:12 AM, Prasad, Ramit wrote: > It seems to me that if I add a function to the list of class attributes it > will automatically wrap with "self" but adding it to the object directly will > not wrap the function as a method. Can somebody explain why? I would have > thoug

Re: Why no warnings when re-assigning builtin names?

2011-08-31 Thread Chris Torek
(I realize this thread is old. I have been away for a few weeks. I read through the whole thread, though, and did not see anyone bring up this one particular point: there is already a linting script that handles this.) >On Mon, Aug 15, 2011 at 10:52 PM, Gerrat Rickert > wrote: >> With surprising

Re: try... except with unknown error types

2011-08-31 Thread Chris Torek
In article , Terry Reedy wrote: >I would expect that catching socket.error (or even IOError) should catch >all of those. > >"exception socket.error >A subclass of IOError ... Except that, as Steven D'Aprano almost noted elsethread, it isn't (a subclass of IOError -- the note was that it is not

Re: Why do class methods always need 'self' as the first parameter?

2011-08-31 Thread Chris Torek
>In article <0dc26f12-2541-4d41-8678-4fa53f347...@g9g2000yqb.googlegroups.com> T. Goodchild asked, in part: >>... One of the things that bugs me is the requirement that all class >>methods have 'self' as their first parameter. In article <4e5e5628$0$29977$c3e8da3$54964...@news.astraweb.com> Steven

Re: Text file with mixed end-of-line terminations

2011-08-31 Thread Chris Rebert
On Wed, Aug 31, 2011 at 12:37 PM, Alex van der Spek wrote: > I have a text file that uses both '\r' and '\r\n' end-of-line terminations. > > The '\r' terminates the first 25 lines or so, the remainder is termiated > with '\r\n' > Is there a way to make it read one line at a time, regardless of th

Text file with mixed end-of-line terminations

2011-08-31 Thread Alex van der Spek
I have a text file that uses both '\r' and '\r\n' end-of-line terminations. The '\r' terminates the first 25 lines or so, the remainder is termiated with '\r\n' Reading this file like this: for line in open(filename,'r'): line= #Do whatever needs doing... The first line

Re: Closures and Partial Function Application

2011-08-31 Thread Travis Parks
On Aug 31, 2:03 pm, "bruno.desthuilli...@gmail.com" wrote: > On 31 août, 18:45, Travis Parks wrote: > > > I was a little disappointed the other day when I realized that > > closures were read-only. I like to use closures quite a bit. > > They are not _strictly_ read only, but Python being first a

Re: Python Tools for Visual Studio - anyone using it?

2011-08-31 Thread Brian Curtin
On Wed, Aug 31, 2011 at 14:29, Andrew McLean wrote: > I understand that Python Tools for Visual Studio doesn't work with VS > Express, but does work with the (free) VS 2010 Shell. Does anyone know if > you can install VS Express and VS Shell on the same machine? Yes, because the shell and Expre

Re: Python Tools for Visual Studio - anyone using it?

2011-08-31 Thread Andrew McLean
I understand that Python Tools for Visual Studio doesn't work with VS Express, but does work with the (free) VS 2010 Shell. Does anyone know if you can install VS Express and VS Shell on the same machine? -- http://mail.python.org/mailman/listinfo/python-list

Re: fun with nested loops

2011-08-31 Thread Chris Angelico
On Thu, Sep 1, 2011 at 5:07 AM, Daniel wrote: >> Do you only ever have one top-level loop that you would be naming? If > no, unfortunately not. The rough structure is several loops deep, and > I need to break/continue/restart many of them. > Continue is used more than break, because most of the ti

Re: fun with nested loops

2011-08-31 Thread Daniel
> Do you only ever have one top-level loop that you would be naming? If no, unfortunately not. The rough structure is several loops deep, and I need to break/continue/restart many of them. Continue is used more than break, because most of the time that I find some strange value, I'd just _continue

Re: fun with nested loops

2011-08-31 Thread Daniel
> one more idea, a kind of named loop: interesting idea, thanks. > > When it become too complicate, I use state > machine:http://en.wikipedia.org/wiki/Finite-state_machine I unsuccessfully played a bit with a FSM, but there is a lot of data that is passed around between the states and a lot of

Re: Closures and Partial Function Application

2011-08-31 Thread bruno.desthuilli...@gmail.com
On 31 août, 18:45, Travis Parks wrote: > I was a little disappointed the other day when I realized that > closures were read-only. I like to use closures quite a bit. They are not _strictly_ read only, but Python being first and foremost an OO language, it's usually way simpler to use OO instead

Re: Why do class methods always need 'self' as the first parameter?

2011-08-31 Thread Chris Rebert
On Wed, Aug 31, 2011 at 10:12 AM, Prasad, Ramit wrote: >>def double(obj): return 2*obj.value >> >>class C: >>     def __init__(self, val): >>         self.value = val >> >>c = C(3) >>C.double = double >>c.doub = double >># not c.double as that would mask access to C.double in c.double() below >>pr

Re: Closures and Partial Function Application

2011-08-31 Thread Travis Parks
On Aug 31, 2:18 pm, Ian Kelly wrote: > On Wed, Aug 31, 2011 at 12:02 PM, Travis Parks wrote: > > Am I doing something wrong, here? nonlocal isn't registering. Which > > version did this get incorporated? > > 3.0 Ah, okay. It would be really useful for unit testing. Unfortunately, I want to make

Re: Closures and Partial Function Application

2011-08-31 Thread Ian Kelly
On Wed, Aug 31, 2011 at 12:02 PM, Travis Parks wrote: > Am I doing something wrong, here? nonlocal isn't registering. Which > version did this get incorporated? 3.0 -- http://mail.python.org/mailman/listinfo/python-list

Re: fun with nested loops

2011-08-31 Thread Chris Angelico
On Thu, Sep 1, 2011 at 1:51 AM, Daniel wrote: > > Has anyone an idea on a nice way to write breaks/continues/redos for > deeply > nested loops? > Do you only ever have one top-level loop that you would be naming? If so, put that loop into a function and use return instead of break. Unfortunately

Re: Closures and Partial Function Application

2011-08-31 Thread Travis Parks
On Aug 31, 1:51 pm, Travis Parks wrote: > On Aug 31, 1:18 pm, Chris Rebert wrote: > > > On Wed, Aug 31, 2011 at 9:45 AM, Travis Parks > > wrote: > > > I was a little disappointed the other day when I realized that > > > closures were read-only. I like to use closures quite a bit. > > > Assuming

Re: Closures and Partial Function Application

2011-08-31 Thread Travis Parks
On Aug 31, 1:18 pm, Chris Rebert wrote: > On Wed, Aug 31, 2011 at 9:45 AM, Travis Parks wrote: > > I was a little disappointed the other day when I realized that > > closures were read-only. I like to use closures quite a bit. > > Assuming I'm intuiting your question correctly, then you're incorr

Re: Subclassing str object

2011-08-31 Thread Yaşar Arabacı
@Ian: Thanks for you comments. I indeed didn't need the _sozcuk attribute at all, so I deleted it. My class's addition and multiplication works without overwriting __add__ and __mul__ because, this class uses unicode's __add__ and __mul__ than creates a new kelime instance with return value of thos

Re: Python Tools for Visual Studio - anyone using it?

2011-08-31 Thread mfperzel
On Aug 30, 1:34 pm, Philip Semanchuk wrote: > Hi all, > I was reminded today (via Slashdot) of Python Tools for Visual Studio which > was discussed on this list back in March > (http://mail.python.org/pipermail/python-list/2011-March/1267662.html) and > has reached version 1.0. Is anyone here u

Re: Closures and Partial Function Application

2011-08-31 Thread Chris Rebert
On Wed, Aug 31, 2011 at 9:45 AM, Travis Parks wrote: > I was a little disappointed the other day when I realized that > closures were read-only. I like to use closures quite a bit. Assuming I'm intuiting your question correctly, then you're incorrect; they are "read/write". You just need a `nonlo

RE: Why do class methods always need 'self' as the first parameter?

2011-08-31 Thread Prasad, Ramit
>def double(obj): return 2*obj.value > >class C: > def __init__(self, val): > self.value = val > >c = C(3) >C.double = double >c.doub = double ># not c.double as that would mask access to C.double in c.double() below >print(double(c), C.double(c), c.double(), c.doub(c)) Sorry if I get

Re: Installing WebDAV server

2011-08-31 Thread Paul Kölle
Hi, answers below... Am 31.08.2011 14:18, schrieb Fokke Nauta: "Paul Kölle" wrote in message news:mailman.595.1314780791.27778.python-l...@python.org... Hi, Am 30.08.2011 22:00, schrieb Fokke Nauta: Hi all, I am completely new to Python, but I'm confronted with a problem I can't solve. Wel

Re: Subclassing str object

2011-08-31 Thread Ian Kelly
2011/8/31 Yaşar Arabacı : > I made a class like this (I shortened it just to show the point), what do > you think about it, do you think it is the python way of subclassing str (or > unicode in this case) You don't need the _sozcuk attribute at all here. It's just the same as the value of the uni

Re: Subclassing str object

2011-08-31 Thread Terry Reedy
On 8/31/2011 7:43 AM, Yaşar Arabacı wrote: Hİ, I originally posted my question to here: http://stackoverflow.com/q/7255655/886669 Could you people please look at it and enlighten me a little bit? I would appreciate an answer either from here or at stackoverflow. I believe two people already ga

Re: Closures and Partial Function Application

2011-08-31 Thread Arnaud Delobelle
On 31 August 2011 17:45, Travis Parks wrote: > I was a little disappointed the other day when I realized that > closures were read-only. I like to use closures quite a bit. > > Can someone explain why this limitation exists? Secondly, since I can > cheat by wrapping the thing being closure-ified,

Closures and Partial Function Application

2011-08-31 Thread Travis Parks
I was a little disappointed the other day when I realized that closures were read-only. I like to use closures quite a bit. Can someone explain why this limitation exists? Secondly, since I can cheat by wrapping the thing being closure-ified, how can I write a simple wrapper that has all the same

Re: Usage of PyDateTime_FromTimestamp

2011-08-31 Thread MRAB
On 31/08/2011 04:39, Andreas wrote: Am 30.08.2011 23:49, schrieb MRAB: The key phrase is "argument tuple". The arguments passed to a Python call are always a tuple, not PyFloat_Object. You can build a tuple from the PyFloat_Object using: Py_BuildValue("(O)", float_object) The "(O)" says

Re: fun with nested loops

2011-08-31 Thread aspineux
On Aug 31, 5:51 pm, Daniel wrote: > Dear All, > > I have some complicated loops of the following form > > for c in configurations: # loop 1 >     while nothing_bad_happened: # loop 2 >         while step1_did_not_work: # loop 3 >             for substeps in step1 # loop 4a >                 # at t

Re: Why do class methods always need 'self' as the first parameter?

2011-08-31 Thread Terry Reedy
On 8/31/2011 10:35 AM, T. Goodchild wrote: But one of the things that bugs me is the requirement that all class methods have 'self' as their first parameter. On a gut level, to me this seems to be at odds with Python’s dedication to simplicity. Actually, it is a consequence of Python's dedica

Re: Why do class methods always need 'self' as the first parameter?

2011-08-31 Thread Grant Edwards
On 2011-08-31, Steven D'Aprano wrote: > Well obviously the C++ people thought so :) Well _that's_ certainly a ringing endorsement in the context of designing a language that's easy to understand and use. ;) -- Grant Edwards grant.b.edwardsYow! Where's SANDY DUNCAN?

Re: How to save the packages received by a network interface or some port in a file and resend the packages received when needed?

2011-08-31 Thread Emile van Sebille
On 8/31/2011 8:37 AM king6c...@gmail.com said... In fact,UDP is enough for me,I heared that tcpdump and netcat can store and resend the udp packages to get the replay effect,but I don't know how, That may be, but I've never tried that. or is there some better way? I am working on a Linux ser

Re: Why do class methods always need 'self' as the first parameter?

2011-08-31 Thread Steven D'Aprano
John Gordon wrote: > In <0dc26f12-2541-4d41-8678-4fa53f347...@g9g2000yqb.googlegroups.com> "T. > Goodchild" writes: > >> So why is 'self' necessary on class methods? It seems to me that the >> most common practice is that class methods *almost always* operate on >> the instance that called them

Re: Subclassing str object

2011-08-31 Thread Yaşar Arabacı
I made a class like this (I shortened it just to show the point), what do you think about it, do you think it is the python way of subclassing str (or unicode in this case) # -*- coding:utf-8 -*-class kelime(unicode): def __init__(self,sozcuk): self._sozcuk = sozcuk def __getattr

fun with nested loops

2011-08-31 Thread Daniel
Dear All, I have some complicated loops of the following form for c in configurations: # loop 1 while nothing_bad_happened: # loop 2 while step1_did_not_work: # loop 3 for substeps in step1 # loop 4a # at this point, we may have to -leave lo

Re: Handling 2.7 and 3.0 Versions of Dict

2011-08-31 Thread Ian Kelly
On Wed, Aug 31, 2011 at 3:55 AM, Martin v. Loewis wrote: > if sys.version_info < (3,): > def getDictValues(dict): > return dict.itervalues() > else: > def getDictValues(dict): > return dict.values() The extra level of function call indirection is unnecessary here. Better to write it a

Re: Why do class methods always need 'self' as the first parameter?

2011-08-31 Thread Steven D'Aprano
T. Goodchild wrote: > So why is 'self' necessary on class methods? I assume you are talking about the declaration in the method signature: def method(self, args): ... rather than why methods have to be called using self.method. If not, there's already a FAQ for that second question: http://d

Re: How to save the packages received by a network interface or some port in a file and resend the packages received when needed?

2011-08-31 Thread king6c...@gmail.com
In fact,UDP is enough for me,I heared that tcpdump and netcat can store and resend the udp packages to get the replay effect,but I don't know how, or is there some better way? I am working on a Linux server and only some basic terminal tools are available :) 2011/8/31 Emile van Sebille > On 8/31

Re: Why do class methods always need 'self' as the first parameter?

2011-08-31 Thread Javier Collado
Hello, 2011/8/31 T. Goodchild : > But one of the things that bugs me is the requirement that all class > methods have 'self' as their first parameter.  On a gut level, to me > this seems to be at odds with Python’s dedication to simplicity. I think the answer to this question is part of the zen o

Re: Why do class methods always need 'self' as the first parameter?

2011-08-31 Thread Neil Cerutti
On 2011-08-31, T. Goodchild wrote: > I?m new to Python, and I love it. The philosophy of the > language (and of the community as a whole) is beautiful to me. > > But one of the things that bugs me is the requirement that all > class methods have 'self' as their first parameter. On a gut > level,

Re: Why do class methods always need 'self' as the first parameter?

2011-08-31 Thread Emile van Sebille
On 8/31/2011 7:35 AM T. Goodchild said... Just curious about the rationale behind this part of the language. http://docs.python.org/faq/design.html -- http://mail.python.org/mailman/listinfo/python-list

Re: Why do class methods always need 'self' as the first parameter?

2011-08-31 Thread John Gordon
In <0dc26f12-2541-4d41-8678-4fa53f347...@g9g2000yqb.googlegroups.com> "T. Goodchild" writes: > So why is 'self' necessary on class methods? It seems to me that the > most common practice is that class methods *almost always* operate on > the instance that called them. It would make more sense

Re: How to save the packages received by a network interface or some port in a file and resend the packages received when needed?

2011-08-31 Thread Emile van Sebille
On 8/31/2011 6:35 AM king6c...@gmail.com said... hi, This is a question not specific to Python,but its related somehow,and I believe I can get some help from your fellow:) I am doing my work on a server service program on Linux that processes the packages sent to the socket it listens.Their

Why do class methods always need 'self' as the first parameter?

2011-08-31 Thread T. Goodchild
I’m new to Python, and I love it. The philosophy of the language (and of the community as a whole) is beautiful to me. But one of the things that bugs me is the requirement that all class methods have 'self' as their first parameter. On a gut level, to me this seems to be at odds with Python’s d

Creating python egg including pre-built libraries

2011-08-31 Thread merk
I have a set of complex libraries that I have wrapped with swig. I would like to create a python egg of the swig generated python files and the pre-built libraries. The libraries have a lot of dependencies and I don't want to force the user to get all the dependencies to try to build the librar

Re: Installing WebDAV server

2011-08-31 Thread Fokke Nauta
"Laszlo Nagy" wrote in message news:mailman.603.1314797809.27778.python-l...@python.org... > >>> Where it says: >>> Installation and setup of server can be as easy as follows: $ easy_installPyWebDAV $ davserver-D/tmp-n-J Starting upPyWebDAV server(version0.9.2-dev)

Re: How to save the packages received by a network interface or some port in a file and resend the packages received when needed?

2011-08-31 Thread Grant Edwards
On 2011-08-31, Matty Sarro wrote: > Its possible using TCPDUMP and wireshark. however its a bit of a > manual process (open the pcap in wireshark, select the correct tcp > stream, and extract the file). Presumably the OP knows the port IP address and port number on which the server is listening,

Re: Returning a value from exec or a better solution

2011-08-31 Thread Ian Kelly
On Wed, Aug 31, 2011 at 12:35 AM, Arnaud Delobelle wrote: >> You don't know that, an implementation may for example set __bultins__ >> to None, prior to returning, its not an unreasonable thing to do and >> the docs don't say they can't. > > I haven't studied the docs but I'm certain that such an

Re: How to save the packages received by a network interface or some port in a file and resend the packages received when needed?

2011-08-31 Thread Matty Sarro
Its possible using TCPDUMP and wireshark. however its a bit of a manual process (open the pcap in wireshark, select the correct tcp stream, and extract the file). I did this to show a vulnerability in how medical images were transmitted in a university hospital once :) Here are some guides, maybe

Re: PC locks up with list operations

2011-08-31 Thread Rodrick Brown
$ man limits.conf Sent from my iPhone On Aug 31, 2011, at 8:33 AM, Steven D'Aprano wrote: > Twice in a couple of weeks, I have locked up my PC by running a Python 2.5 > script that tries to create a list that is insanely too big. > > In the first case, I (stupidly) did something like: > > m

Re: PC locks up with list operations

2011-08-31 Thread Robert Spanjaard
On 08/31/2011 02:40 PM, Chris Withers wrote: On 31/08/2011 13:33, Steven D'Aprano wrote: I am using Linux desktops; both incidents were with Python 2.5. Do newer versions of Python respond to this sort of situation more gracefully? Ironically, Windows does better here and dumps you out with a

Re: Installing WebDAV server

2011-08-31 Thread Laszlo Nagy
Where it says: Installation and setup of server can be as easy as follows: $ easy_installPyWebDAV $ davserver-D/tmp-n-J Starting upPyWebDAV server(version0.9.2-dev) ATTENTION: Authentication disabled! Serving datafrom /tmp Listening on localhost(8008) Yes, but that's Unix/Linux

Re: Handling 2.7 and 3.0 Versions of Dict

2011-08-31 Thread Martin v. Loewis
Am 31.08.2011 03:43, schrieb Travis Parks: > I am writing a simple algorithms library that I want to work for both > Python 2.7 and 3.x. I am writing some functions like distinct, which > work with dictionaries under the hood. The problem I ran into is that > I am calling itervalues or values depen

How to save the packages received by a network interface or some port in a file and resend the packages received when needed?

2011-08-31 Thread king6c...@gmail.com
hi, This is a question not specific to Python,but its related somehow,and I believe I can get some help from your fellow:) I am doing my work on a server service program on Linux that processes the packages sent to the socket it listens.Their is already a old such service listening on the port

Re: PC locks up with list operations

2011-08-31 Thread Peter Otten
Steven D'Aprano wrote: > Twice in a couple of weeks, I have locked up my PC by running a Python 2.5 > script that tries to create a list that is insanely too big. > > In the first case, I (stupidly) did something like: > > mylist = [0]*12345678901234 > > After leaving the machine for THREE DAYS

Re: PC locks up with list operations

2011-08-31 Thread Benjamin Kaplan
On Wed, Aug 31, 2011 at 8:40 AM, Chris Withers wrote: > > On 31/08/2011 13:33, Steven D'Aprano wrote: >> >> I am using Linux desktops; both incidents were with Python 2.5. Do newer >> versions of Python respond to this sort of situation more gracefully? > > Ironically, Windows does better here and

Re: PC locks up with list operations

2011-08-31 Thread Steven D'Aprano
Chris Withers wrote: > On 31/08/2011 13:33, Steven D'Aprano wrote: >> I am using Linux desktops; both incidents were with Python 2.5. Do newer >> versions of Python respond to this sort of situation more gracefully? > > Ironically, Windows does better here and dumps you out with a > MemoryError b

Re: PC locks up with list operations

2011-08-31 Thread Chris Withers
On 31/08/2011 13:33, Steven D'Aprano wrote: I am using Linux desktops; both incidents were with Python 2.5. Do newer versions of Python respond to this sort of situation more gracefully? Ironically, Windows does better here and dumps you out with a MemoryError before slowly recovering. Linux

Re: Installing WebDAV server

2011-08-31 Thread Fokke Nauta
"Laszlo Nagy" wrote in message news:mailman.597.1314791334.27778.python-l...@python.org... > >> What do you mean by STFW? > Search The Fucking Web ? OK, the modern version of RTFM. >> I wasn't aware that easy_install was a utility. Downloaded and installed >> the >> Windows version and run eas

PC locks up with list operations

2011-08-31 Thread Steven D'Aprano
Twice in a couple of weeks, I have locked up my PC by running a Python 2.5 script that tries to create a list that is insanely too big. In the first case, I (stupidly) did something like: mylist = [0]*12345678901234 After leaving the machine for THREE DAYS (!!!) I eventually was able to get to a

Re: Installing WebDAV server

2011-08-31 Thread Fokke Nauta
"Paul Kölle" wrote in message news:mailman.595.1314780791.27778.python-l...@python.org... > Hi, > > Am 30.08.2011 22:00, schrieb Fokke Nauta: >> Hi all, >> >> I am completely new to Python, but I'm confronted with a problem I can't >> solve. > Welcome to python. > >> This is my question: > [snip]

argparse: showing full help for subparsers

2011-08-31 Thread Chris Withers
Hi All, If I have subparsers set up and do: myscript.py --help I get the summary for each of the top-level commands, but to get the help for each sub-command I have to do: myscript.py subcommand --help Is there any way I can get "myscript.py --help" to show the help hierarchically, includi

Re: Installing WebDAV server

2011-08-31 Thread Laszlo Nagy
What do you mean by STFW? Search The Fucking Web ? I wasn't aware that easy_install was a utility. Downloaded and installed the Windows version and run easy_install pywebdav. It downloaded something, installed something and finished something. Then it's installed! But, once again, don't know

Subclassing str object

2011-08-31 Thread Yaşar Arabacı
Hİ, I originally posted my question to here: http://stackoverflow.com/q/7255655/886669 Could you people please look at it and enlighten me a little bit? I would appreciate an answer either from here or at stackoverflow. Thanks in advance. -- http://yasar.serveblog.net/ -- http://mail.python.org

Re: Installing WebDAV server

2011-08-31 Thread Fokke Nauta
"Thomas 'PointedEars' Lahn" wrote in message news:4761603.ypau67u...@pointedears.de... > Fokke Nauta wrote: > >> "Thomas 'PointedEars' Lahn" wrote in message >> news:6545843.yvfaxzv...@pointedears.de... > > It's attribution _line_, not attribution novel. Your quotes are hardly > legible, too ?

Re: Installing WebDAV server

2011-08-31 Thread Paul Kölle
Hi, Am 30.08.2011 22:00, schrieb Fokke Nauta: Hi all, I am completely new to Python, but I'm confronted with a problem I can't solve. Welcome to python. This is my question: [snip] I installed Python 3.2.1 and extracted the packages PyWebDAV and PyXML. Now I have a working Python app and