Re: removing duplication from a huge list.

2009-02-27 Thread Falcolas
On Feb 27, 8:33 am, Tim Rowe digi...@gmail.com wrote: 2009/2/27 odeits ode...@gmail.com: How big of a list are we talking about? If the list is so big that the entire list cannot fit in memory at the same time this approach wont work e.g. removing duplicate lines from a very large file.

Re: removing duplication from a huge list.

2009-02-27 Thread Falcolas
On Feb 27, 10:07 am, Steve Holden st...@holdenweb.com wrote: Assuming no duplicates, how does this help? You still have to verify collisions. Absolutely. But a decent hashing function (particularly since you know quite a bit about the data beforehand) will have very few collisions

Re: Stopping SocketServer on Python 2.5

2009-03-11 Thread Falcolas
On Mar 10, 7:19 pm, David George d...@eatmyhat.co.uk wrote: So, my question is, is there any way to stop a SocketServer that's been told to server forever in python 2.5? serve_forever, in python 2.5, is simply coded as: while 1: self.handle_request() So, instead of calling serve_forever,

Re: Stopping SocketServer on Python 2.5

2009-03-11 Thread Falcolas
On Mar 11, 12:28 pm, David George wrote: On 2009-03-11 04:36:29 +, Mark Tolonen metolone+gm...@gmail.com said: David George d...@eatmyhat.co.uk wrote in message news:00150e67$0$27956$c3e8...@news.astraweb.com... Hi guys, I've been developing some code for a university project

Re: Stopping SocketServer on Python 2.5

2009-03-11 Thread Falcolas
On Mar 11, 1:11 pm, David George d...@eatmyhat.co.uk wrote: Again, problem here is the issue of being unable to kill the server while it's waiting on a request. In theory, i could force it to continue by sending some sort of junk data with the method i use to stop the server, but that seems a

Re: An error in threading.py?

2009-03-11 Thread Falcolas
On Mar 11, 4:15 pm, Oltmans rolf.oltm...@gmail.com wrote: Hi, all. I'm trying to use Mechanize in a multithreaded program-- purpose of which is to fill out a form on a website using concurrent threads. Guys, trust me I've spent a lot of time to figure out the problem but I'm completed puzzled.

Re: Why does Python not return first line?

2009-03-16 Thread Falcolas
On Mar 15, 6:25 pm, Gilles Ganault nos...@nospam.com wrote: address = re_address.search(response) if address: address = address.group(1).strip() #Important! for item in [\t,\r, br /]: address = address.replace(item,) As you found, your script works

Re: Request For Comment

2009-04-07 Thread Falcolas
On Apr 7, 12:57 pm, a...@pythoncraft.com (Aahz) wrote: How RFC1 got created: http://www.nytimes.com/2009/04/07/opinion/07crocker.html Thanks for bring that forward; I thought it was an interesting read and a nice polite (yet much needed) little jab at status-quo. ~G --

Re: Is there a better/simpler way to filter blank lines?

2008-11-04 Thread Falcolas
On Nov 4, 3:30 pm, tmallen [EMAIL PROTECTED] wrote: On Nov 4, 4:30 pm, [EMAIL PROTECTED] wrote: tmallen: I'm parsing some text files, and I want to strip blank lines in the process. Is there a simpler way to do this than what I have here? lines = filter(lambda line: len(line.strip())

Re: iterate start at second row in file not first

2008-05-20 Thread Falcolas
On May 20, 12:34 pm, [EMAIL PROTECTED] wrote: how do i jump the first step there? i dont want to iterate the first row...how do i start at the second? To simply bypass the first line, do a readline() on the file object before starting to process the file. To filter out particular lines

Re: The Modernization of Emacs: terminology buffer and keybinding

2007-06-22 Thread Falcolas
On Jun 22, 11:28 am, Robert Uhl [EMAIL PROTECTED] wrote: That's the advantage of a well-organised set of commands. If you want to use regexp search, you have to look at the dialogue box and click on a checkbox--which would be a context switch. Again, you are assuming that the editor isn't set

Re: Tailing a log file?

2007-06-22 Thread Falcolas
On Jun 22, 12:50 pm, Kenji Noguchi [EMAIL PROTECTED] wrote: I checked the source code for tail and they actually poll the file by using fstat and sleep to check for changes in the file size. This didn't seem right so I thought about it more and realized I ought to be using inotify. So I

Re: The Modernization of Emacs: terminology buffer and keybinding

2007-06-22 Thread Falcolas
On Jun 22, 3:06 pm, Pascal Bourguignon [EMAIL PROTECTED] wrote: How do you call a Mac user interface that let a user work during 3 hours to do a simple modification to a MS-Word file that takes 15 seconds to do with emacs or a simple unix script? Would you mind elaborating on *what* took 3

Re: The Modernization of Emacs: terminology buffer and keybinding

2007-06-22 Thread Falcolas
On Jun 22, 4:12 pm, Pascal Bourguignon [EMAIL PROTECTED] wrote: Anything that the user have to do repeatitively with the GUI, like copy-and-paste, or reformating of a lot of paragraphs or table entries, and which is done automatically by writting a one-liner program in emacs or shell. So the

Capturing stdout from a class method

2007-06-27 Thread Falcolas
I have a rather strange situation, and I'm not sure my brief experience of Python will let me handle it properly. The situation is this: I have a Java class X which I need to call in a Jython script. The output of X is sent to stdout using the java call System.out. I need to capture this output,

Re: appending file

2007-06-29 Thread Falcolas
On Jun 29, 1:04 pm, Kuo [EMAIL PROTECTED] wrote: # FPGA CLOCK^M NET SYSCLK_A loc = N16 | TNM_NET = SYSCLK_A;^M NET SYSCLK_AN loc = M16 | TNM_NET = SYSCLK_A;^M I see those bloody ^M's anytime I have to deal with a DOS file (since it's the carrage return \r character). Is 'pin' a DOS

Re: Python's only one way to do it philosophy isn't good?

2007-07-05 Thread Falcolas
On Jul 5, 10:30 am, Chris Mellon [EMAIL PROTECTED] wrote: I don't think anyone has suggested that. Let me be clear about *my* position: When you need to ensure that a file has been closed by a certain time, you need to be explicit about it. When you don't care, just that it will be closed

Re: Copy List

2007-07-19 Thread Falcolas
On Jul 18, 6:56 am, Rustom Mody [EMAIL PROTECTED] wrote: This is shallow copy If you want deep copy then from copy import deepcopy What will a deep copy of a list give you that using the slice notation will not? -- http://mail.python.org/mailman/listinfo/python-list

os.fork leaving processes behind

2007-12-27 Thread Falcolas
Hi all, This may be more of a Linux question, but it relates to how Python forks... Today, I implemented a pretty simple listener script using os.fork. The script runs fine, and performs as expected, but the process table is left with an odd entry for every fork called. I'm running on Slackware

Re: os.fork leaving processes behind

2007-12-31 Thread Falcolas
On Dec 28, 12:11 am, Gabriel Genellina [EMAIL PROTECTED] wrote: I'd try to use any of the existing server implementations in SocketServer.py, but if you insist on using your own, look at the ForkingMixin class as an example of using waitpid() to avoid having zombie processes. -- Gabriel

HTML Parser for Jython

2007-10-17 Thread Falcolas
Does anybody know of a decent HTML parser for Jython? I have to do some screen scraping, and would rather use a tested module instead of rolling my own. Thanks! GP -- http://mail.python.org/mailman/listinfo/python-list

Re: HTML Parser for Jython

2007-10-17 Thread Falcolas
On Oct 17, 9:50 am, Carsten Haese [EMAIL PROTECTED] wrote: Recent releases of BeautifulSoup need Python 2.3+, so they won't work on current Jython, but BeatifulSoup 1.x will work. Thank you. -- http://mail.python.org/mailman/listinfo/python-list

Functions as Objects, and persisting values

2007-11-05 Thread Falcolas
Please help me understand the mechanics of the following behavior. def d(): header = 'I am in front of ' def e(something): print header + something return e f = d() f('this') I am in front of this del(d) f('this') I am in front of this The way I

Re: The Modernization of Emacs: terminology buffer and keybinding

2007-06-21 Thread Falcolas
On Jun 21, 10:09 am, Robert Uhl [EMAIL PROTECTED] wrote: You're quite right. Windows/Mac user interfaces are so clunky that they massively hamper productivity. Emacs, OTOH, enables it. For example, C-s is search forward; C-r is search backward ('reverse'); C-M-s is search forward for a

Re: The Modernization of Emacs: terminology buffer and keybinding

2007-06-21 Thread Falcolas
On Jun 21, 2:10 pm, Kaldrenon [EMAIL PROTECTED] wrote: I don't think anyone can make the argument that any (past or current) graphics-based editor is as efficient when being used to its fullest as a text-based editor. It's basic math - it takes measurably more time to move a hand to the mouse,

Re: urllib2 - 403 that _should_ not occur.

2009-01-13 Thread Falcolas
On Jan 11, 6:59 pm, James Mills prolo...@shortcircuit.net.au wrote: Hey all, The following fails for me: from urllib2 import urlopen f = urlopen(http://groups.google.com/group/chromium-announce/feed/rss_v2_0_msgs.xml;) For what it's worth, I've had a similar problem with the urlopen as

Re: CSV readers and UTF-8 files

2009-02-19 Thread Falcolas
On Feb 19, 7:21 am, mk mrk...@gmail.com wrote: Hello everyone, Is it just me or CSV reader/DictReader and UTF-8 files do not work correctly in Python 2.6.1 (Windows)? I would point out in the CSV module documentation (http:// docs.python.org/library/csv.html) it explicitly mentions that it

Re: Will multithreading make python less popular?

2009-02-19 Thread Falcolas
On Feb 19, 1:18 pm, Paul Rubin http://phr...@nospam.invalid wrote: ...  If such speedups were useless or unimportant, we would not have blown our hard earned cash replacing perfectly good older hardware, so we have to accept the concept that speed matters and ignore those platitudes that say

Re: Will multithreading make python less popular?

2009-02-19 Thread Falcolas
On Feb 19, 3:11 pm, Paul Rubin http://phr...@nospam.invalid wrote: Falcolas garri...@gmail.com writes: It's a proposition that used to bother me, until I did some actual programming of real world problems in Python. I've yet to really find a case where the application was slow enough

Re: ImportError: No module named _md5 - please help

2009-10-29 Thread Falcolas
On Oct 29, 9:13 am, user7304 wadie...@gmail.com wrote: Hi, I am trying to run a python script and got this error. import _md5 ImportError: No module named _md5 Googling the problem suggested that I install the 'py25-hashlib'. the following does not work for me 'sudo port install

Re: Recommended number of threads? (in CPython)

2009-10-29 Thread Falcolas
On Oct 29, 9:56 am, mk mrk...@gmail.com wrote: Hello everyone, I wrote run-of-the-mill program for concurrent execution of ssh command over a large number of hosts. (someone may ask why reinvent the wheel when there's pssh and shmux around -- I'm not happy with working details and lack of

Re: list comprehension problem

2009-10-29 Thread Falcolas
On Oct 29, 9:31 am, Diez B. Roggisch de...@nospam.web.de wrote: mk wrote: Hello everyone, print hosts hosts = [ s.strip() for s in hosts if s is not '' and s is not None and s is not '\n' ] print hosts ['9.156.44.227\n', '9.156.46.34 \n', '\n'] ['9.156.44.227', '9.156.46.34', '']

Re: TODO and FIXME tags

2009-11-17 Thread Falcolas
On Nov 17, 4:27 am, Martin P. Hellwig martin.hell...@dcuktec.org wrote: Ben Finney wrote: Chris Rebert c...@rebertia.com writes: 2009/11/16 Yasser Almeida Hernández pedro...@fenhi.uh.cu: How is the sintaxis for set the TODO and FIXME tags...? There is no special syntax for those. Some

Re: how to format a python source file with tools?

2009-11-30 Thread Falcolas
On Nov 30, 7:37 am, gil_johnson x7-g5w...@earthlink.net wrote: On Nov 27, 9:58 am, Diez B. Roggisch de...@nospam.web.de wrote: [...] so i would like to have a tool to intelligently format the code for me and make the code more beautiful and automated. This is not possible. Consider

Closures in metaclasses

2010-01-21 Thread Falcolas
I'm running into an issue with closures in metaclasses - that is, if I create a function with a closure in a metaclass, the closure appears to be lost when I access the final class. I end up getting the text 'param' instead of the actual tags I am expecting: ALL_TAGS = ['a', 'abbr', 'acronym',

Re: Closures in metaclasses

2010-01-21 Thread Falcolas
On Jan 21, 11:24 am, Arnaud Delobelle arno...@googlemail.com wrote: Falcolas garri...@gmail.com writes: I'm running into an issue with closures in metaclasses - that is, if I create a function with a closure in a metaclass, the closure appears to be lost when I access the final class. I end

Re: Closures in metaclasses

2010-01-21 Thread Falcolas
On Jan 21, 12:10 pm, Arnaud Delobelle arno...@googlemail.com wrote: On Jan 21, 6:37 pm, Falcolas garri...@gmail.com wrote: On Jan 21, 11:24 am, Arnaud Delobelle arno...@googlemail.com wrote: It was the easiest way I found to add a lot of static methods to the Tag class without writing

Re: Closures in metaclasses

2010-01-21 Thread Falcolas
On Jan 21, 1:55 pm, Peter Otten __pete...@web.de wrote: Falcolas wrote: I tried overriding __getattr__ and got an error at runtime (the You can either move __getattr__() into the metaclass or instantiate the class. I prefer the latter. Both approaches in one example: class Tag

Re: your favorite debugging tool?

2009-08-25 Thread Falcolas
On Aug 23, 1:21 am, Hendrik van Rooyen hend...@microcorp.co.za wrote: On Saturday 22 August 2009 16:49:22 Aahz wrote: In article mailman.227.1250951162.2854.python-l...@python.org, Esmail  ebo...@hotmail.com wrote: What is your favorite tool to help you debug your code? I've been

Re: conditional for-statement

2009-08-25 Thread Falcolas
On Aug 25, 11:25 am, seb sdemen...@gmail.com wrote: We could as consistenly explain that the syntax for n in range(10) if n%3==0:   body means for n in range(10):   if n%3==0:     body This syntax has also the benefit of avoiding an extra level of indentation (the one for the if) that

Re: conditional for-statement

2009-08-25 Thread Falcolas
On Aug 25, 1:58 pm, seb sdemen...@gmail.com wrote: On Aug 25, 9:42 pm, Falcolas garri...@gmail.com wrote: On Aug 25, 11:25 am, seb sdemen...@gmail.com wrote: So, what part of the statement does the if statement belong to; particularly a concern considering this is valid python: for x

Re: Creating slice notation from string

2009-09-03 Thread Falcolas
On Sep 2, 3:55 pm, bvdp b...@mellowood.ca wrote: I'm trying to NOT create a parser to do this and I'm sure that it's easy if I could only see the light! Is it possible to take an arbitrary string in the form 1:2, 1, :-1, etc. and feed it to slice() and then apply the result to an

Re: Podcast catcher in Python

2009-09-11 Thread Falcolas
On Sep 11, 8:20 am, Chuck galois...@gmail.com wrote: Hi all, I would like to code a simple podcast catcher in Python merely as an exercise in internet programming.  I am a CS student and new to Python, but understand Java fairly well.  I understand how to connect to a server with urlopen,

Re: Storing a C pointer in a Python class instance

2009-09-29 Thread Falcolas
On Sep 29, 2:27 am, lallous lall...@lgwm.org wrote: Hello From my C extension module I want to store a C pointer in a given PyObject. The only way I figure how to do it is to use Py_BuildValues and store the poiner casted to Py_ssize_t, thus: Py_BuildValues(n, (Py_ssize_t)my_ptr) Can it

Re: Cannot get POST to work

2009-09-29 Thread Falcolas
On Sep 29, 10:24 am, tedpot...@gmail.com tedpot...@gmail.com wrote: Hi, I'm trying to post data to a short test script in php I wrote. The python code to do the post is import httplib #server address conn = httplib.HTTPConnection(localhost) #file location conn.request(POST,

Re: best vi / emacs python features

2009-10-07 Thread Falcolas
On Oct 7, 10:44 am, Jean-Michel Pichavant jeanmic...@sequans.com wrote: OdarR wrote: hello, * this is not a troll * which kind of help you have with your favorite editor ? personnally, I find emacs very nice, in the current state of my knowledge, when I need to reindent the code.

Re: best vi / emacs python features

2009-10-08 Thread Falcolas
On Oct 8, 7:23 am, Jean-Michel Pichavant jeanmic...@sequans.com wrote: Chris Jones wrote: On Wed, Oct 07, 2009 at 07:06:08PM EDT, TerryP wrote: [..] I am a freak: I do not use nor want syntax highlighting. I don't want my editor to understand mail, irc, or the www either, I want it to

Re: The rap against while True: loops

2009-10-12 Thread Falcolas
On Oct 12, 12:32 pm, Mensanator mensana...@aol.com wrote: On Oct 12, 1:02 pm, John Reid j.r...@mail.cryst.bbk.ac.uk wrote: Mensanator wrote: On Oct 12, 3:36 am, greg g...@cosc.canterbury.ac.nz wrote: Mensanator wrote: while not done: ... if n==1: done = True ... Seems to me

Re: Python XMLRPC question

2009-10-13 Thread Falcolas
On Oct 13, 12:47 pm, prasanna prasa...@ix.netcom.com wrote: In using Python's XMLRPC, there is a statement that gets printed on stdout of the form:                  localhost - - [12/Oct/2009 23:36:12] POST /RPC2 HTTP/ 1.0 200 - Where does this message originate? Can I turn it off, or at

Re: python along or bash combined with python (for manipulating files)

2009-10-14 Thread Falcolas
On Oct 13, 10:18 pm, TerryP bigboss1...@gmail.com wrote: On Oct 14, 2:13 am, Peng Yu pengyu...@gmail.com wrote: Bash is easy to use on manipulating files and directories (like change name or create links, etc) and on calling external programs. For simple functions, bash along is enough.

Re: Checking a Number for Palindromic Behavior

2009-10-21 Thread Falcolas
On Oct 20, 11:18 am, ru...@yahoo.com wrote: Why *not* answering a question in comp.lang.python because you think it is homework is BAD. 1) It may look like a homework problem to you but it  probably isn't.  Seehttp://groups.google.com/group/comp.lang.python/msg/8ac6db43b09fdc92 Homework

Re: How to write a daemon program to monitor symbolic links?

2009-10-23 Thread Falcolas
On Oct 23, 1:25 pm, Peng Yu pengyu...@gmail.com wrote: As far as I know, linux doesn't support a system level way to figure out all the symbolic links point to a give file. I could do a system wide search to look for any symbolic link that point to the file that I am interested in. But this

Re: How to write a daemon program to monitor symbolic links?

2009-10-23 Thread Falcolas
On Oct 23, 1:38 pm, Falcolas garri...@gmail.com wrote: On Oct 23, 1:25 pm, Peng Yu pengyu...@gmail.com wrote: As far as I know, linux doesn't support a system level way to figure out all the symbolic links point to a give file. I could do a system wide search to look for any symbolic

Re: n00b confusion re: local variable referenced before assignment error

2009-06-19 Thread Falcolas
On Jun 19, 10:16 am, Wells Oliver we...@submute.net wrote: Writing a class which essentially spiders a site and saves the files locally. On a URLError exception, it sleeps for a second and tries again (on 404 it just moves on). The relevant bit of code, including the offending method: [snip]

Re: Confessions of a Python fanboy

2009-07-30 Thread Falcolas
On Jul 29, 9:06 pm, r rt8...@gmail.com wrote: 1.) No need to use () to call a function with no arguments. Python -- obj.m2().m3() --ugly   Ruby -- obj.m1.m2.m3  -- sweeet! Man, i must admit i really like this, and your code will look so much cleaner. I personally would not prefer this, and

Re: Confessions of a Python fanboy

2009-07-30 Thread Falcolas
On Jul 30, 11:56 am, Masklinn maskl...@masklinn.net wrote: On 30 Jul 2009, at 19:37 , Jean-Michel Pichavant wrote: r wrote: How do I know if foo.value is an attribute or if it is a method that   returns the foo value ? It cannot be an attribute. Ruby doesn't give access to attributes,  

Re: Confessions of a Python fanboy

2009-07-31 Thread Falcolas
On Jul 31, 3:49 am, Masklinn maskl...@masklinn.net wrote: On 31 Jul 2009, at 10:25 , Chris Rebert wrote: On Fri, Jul 31, 2009 at 1:21 AM, Xavier Hocont...@xavierho.com   wrote: On Fri, Jul 31, 2009 at 6:08 PM, Masklinn maskl...@masklinn.net   wrote: snip... but since Python doesn't

Re: How to launch a function at regular time intervals ?

2009-08-13 Thread Falcolas
On Aug 12, 3:09 pm, David davig...@googlemail.com wrote: Hi all, I'm trying to launch a function at regular time intervals but cannot find the way to do it. Here is the code I wrote (time_interval is a user defined variable in seconds): [snip] Has anyone run into a similar problem (and solved

Re: What text editor is everyone using for Python

2009-05-29 Thread Falcolas
I am a long time VIM user, and I likely will not change that. The speed, ease of use and functionality, for me, is worth the time spent learning how to use it. My secondary editor on the desktop is UltraEdit, which does a fine job as a text editor and has all the same functionality of VIM - yet

Multiprocessing.Pipe in a daemon

2011-12-21 Thread Falcolas
So, I'm running into a somewhat crazy bug. I am running several workers using multiprocessing to handle gearman requests. I'm using pipes to funnel log messages from each of the workers back to the controlling process, which iterates over the other end of the pipe, looking for messages with