Re: why would anyone use python when java is there?

2006-11-30 Thread Richie Hindle
[Adam] > For the life of me I can't understand why he would troll > comp.lang.python when comp.lang.lisp is there. +1 QOTW! -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: why would anyone use python when java is there?

2006-11-30 Thread Richie Hindle
the week about Python than comp.lang.python itself. Point taken... but had Adam said "For the life of me I can't understand why he would troll comp.lang.python when the rest of usenet is there" I would have still voted QOTW. It was a pro-comp.lang.python vote, not an anti-comp.lang.lisp vote.

Re: PythonTidy

2006-11-30 Thread Richie Hindle
rce encoding > directive for correct interpretation of u"..." strings by Python > interpreter. So is "# vim: set fileencoding=utf-8". Anything matching "coding[:=]\s*([-\w.]+)" on the first or second line counts. > See http://www.python.org/dev/peps/pep

Re: file_name_fixer.py

2006-01-25 Thread Richie Hindle
re.match(r'(xx+)\1+$', 'x'*n) finds prime numbers. I'll get me coat. -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: templates

2006-01-31 Thread Richie Hindle
y invalid, HTML.) Incidentally, I'm changing PyMeld's license from Sleepycat to BSD, making it free for use in closed source projects. (I'll get around to updating the website RSN 8-) -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: templates

2006-01-31 Thread Richie Hindle
[thakadu] > The method of generation the table rows was exactly the same as > the example in the PyMeld documentation Did you try using toFormatString() to speed it up? See http://www.entrian.com/PyMeld/doco.html -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/li

Re: Python V2.4.2 source code

2006-02-06 Thread Richie Hindle
[John] > That particular file doesn't include the implementation files for the core > modules. *Which* particular file? Give us a URL. The source tarball at http://www.python.org/2.4.2/ (full URL http://www.python.org/ftp/python/2.4.2/Python-2.4.2.tgz) contains the full source.

Re: Strip white spaces from source

2005-05-09 Thread Richie Hindle
.last_line = line def flush( self ): if self.line is not None: sys.stdout.write( self.line ) if __name__ == '__main__': if len( sys.argv ) != 2: print __doc__ else: file = open( sys.argv[ 1 ], 'rt' ) unSpace = UnSpace() tokenize.tokenize( file.readline, unSpace.onToken ) unSpace.flush() -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Strip white spaces from source

2005-05-10 Thread Richie Hindle
t someone else has solved it but without saying *how*. -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Problems with csv module

2005-05-11 Thread Richie Hindle
,' >>> reader = csv.reader(f, delimiter=Adelimiter) Traceback (most recent call last): File "", line 1, in ? TypeError: bad argument type for built-in operation >>> print type(Adelimiter) -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Problems with csv module

2005-05-11 Thread Richie Hindle
CII NUL characters. Accordingly, all input should generally be printable ASCII to be safe. These restrictions will be removed in the future. " That note is still there in the current development docs, so it looks like it hasn't yet been fixed. -- Richie Hindle [EMAIL PROTECTED] -- ht

Re: Problems with csv module

2005-05-11 Thread Richie Hindle
00 http://diveintopython.org/xml_processing/unicode.html http://www.jorendorff.com/articles/unicode/python.html The short answer to your question is this: >>> U = u'My string' >>> A = U.encode('ascii') >>> print U, type(U), A, type(A) My string My

Re: Launch file in Notepad

2005-05-12 Thread Richie Hindle
ither forward slash or backslash at the OS level - it's only the shells (explorer.exe or to a lesser extent cmd.exe) that don't accept forward slashes. -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Posting a reply to a post in an existing thread

2005-06-09 Thread Richie Hindle
and know that your reply was part of the same thread as the message to which you replied. -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: strip() 2.4.4

2007-06-21 Thread Richie Hindle
:'016':'AMERICAN SAMOA':'American Samoa' """ f1 = StringIO(DATA) for line in f1: print repr(line.rsplit(':')[4].strip("'")) # repr shows the error # This prints: # # "Afghanistan'\n" # "Albania'\n" # "Algeria'\n" # "American Samoa'\n" # # Do this instead: f1.seek(0) for line in f1: print line.strip().rsplit(':')[4].strip("'") # This prints: # # Afghanistan # Albania # Algeria # American Samoa -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: list index()

2007-08-31 Thread Richie Hindle
m the word for something that lives under a bridge. It derives from "trolling for suckers" or "trolling for newbies". -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Coming from Perl

2007-09-13 Thread Richie Hindle
s would be that you don't have cgitb in your server environment, or that you have a bogus one. Rearrange things like this: #!/usr/bin/python print "Content-Type: text/html" print import sys sys.stderr = sys.stdout import cgitb; cgitb.enable(display=0, logdir=".") -- Richie

Re: Coming from Perl

2007-09-13 Thread Richie Hindle
e /usr/bin/python is correct for your hosting environment? -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: changes on disk not visible to script ?

2007-10-08 Thread Richie Hindle
[Bruce] > f.close() > cmd = "echo %s | %s"%(argument_file,the_program) Either: you are a VB programmer and you've actually typed "f.close" rather than "f.close()", Or: you meant "type" (or "cat") rather than "echo",

Re: changes on disk not visible to script ?

2007-10-08 Thread Richie Hindle
[Bruce] > VB programmer!? Thats really harsh.. No offence intended! 8-) -- Richie -- http://mail.python.org/mailman/listinfo/python-list

Re: NUCULAR fielded text searchable indexing

2007-10-10 Thread Richie Hindle
[Paul] > tell us how the software compares to stuff like Lucene or Xapian. +1 -- Richie -- http://mail.python.org/mailman/listinfo/python-list

Re: PyMeld for html templates?

2007-01-19 Thread Richie Hindle
import Meld LAYOUT = """The Title The page information goes here. The real title Here is the info, which would in the real world be read from a file.""" page = Meld(LAYOUT) info = Meld(INFO) page.title = info.title._content page.info = info.info._content print page Is th

Re: PyMeld for html templates?

2007-01-22 Thread Richie Hindle
. req.write(str(meld)) ? -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: OPLC purchase period extended

2007-11-28 Thread Richie Hindle
and it's a real shame they've had to limit its availability to North America. -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: wxPython and twisted problem

2006-04-26 Thread Richie Hindle
s to the other (in theory at least 8-) -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: ascii to latin1

2006-05-09 Thread Richie Hindle
use "NFKD" to normalize things like LATIN SMALL LIGATURE FI and subscript/superscript characters as well as diacritics. -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: ascii to latin1

2006-05-09 Thread Richie Hindle
[Luis] > When I used the "NFD" option, I came across many errors on these and > possibly other codes: \xba, \xc9, \xcd. What errors? This works fine for me, printing "Ecoute": import unicodedata def search_key(s): de_str = unicodedata.normalize("NFD", s) return ''.join([cp for cp in de_

Re: ascii to latin1

2006-05-09 Thread Richie Hindle
t to "st". NFKD normalization doesn't convert VULGAR FRACTION ONE QUARTER into "1/4" - I wonder whether there's some way to do that? > After all they are called *compatibility* code points. Yes, compatible with what the user types. 8-) -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Making all string literals Unicode

2006-05-15 Thread Richie Hindle
Hi, Am I imagining it, or is there a switch or an environment variable to make Python treat all string literals as unicode? I seem to recall seeing it mentioned somewhere, but now I can't find it anywhere. Thanks, -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/lis

Re: Large Dictionaries

2006-05-15 Thread Richie Hindle
, and memory efficiency. A Judy array is extensible and can scale up to a very large number of elements, bounded only by machine memory." ... "PyJudy arrays are similar to Python dictionaries and sets." -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Making all string literals Unicode

2006-05-15 Thread Richie Hindle
uite reasonable and explains why I couldn't find it.) -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Exception style (was: calling python functions using variables)

2006-05-19 Thread Richie Hindle
hat you expect to fail with the given exception. Try this instead: >>> try: >>> command = getattr(commands, VARIABLE) >>> except AttributeError: >>> print >> sys.stderr, "Unknown command", VARIABLE >>> else: >>> command()

Re: urllib2 disable proxy

2008-01-04 Thread Richie Hindle
proxy'] >>> do_stuff_with_urllib2() -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Bug in re.findall?

2008-07-04 Thread Richie Hindle
sole group. > a=ipre.finditer(subnetlist) > >>> a.next().group() > '192.168.100.0' Also correct, because match.group() returns the whole of the matched text. If you wanted just your captured piece, you need this: > >>> a.next().group(1) > '100.' Hope

Re: More like a shell command.

2008-08-06 Thread Richie Hindle
an't achieve what you want without modifying Python's grammar (and turning it into something that isn't Python any more). -- Richie Hindle [EMAIL PROTECTED] Search your Visual Studio projects instantly with Entrian Source Search, our powerful Source Code Search add-in: http

Re: Pyserial again

2006-03-07 Thread Richie Hindle
; get's garbage collected and deleted. [Steve] > The "ser" name is still bound to the serial object, surely? A piece of that code has been chopped off by someone's newsreader - it's the body of a method, and ser.readline() is the last line of that method. -- Ri

Re: Find similar images using python

2006-03-29 Thread Richie Hindle
[Thomas] > How can I use python to find images that looks quite similar? Have you looked at http://www.imgseek.net/ ? It's an Open Source Python photo collection manager that does exactly what you're asking for. -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mai

Re: HTMLParser fragility

2006-04-05 Thread Richie Hindle
[Daniel] > You could try HTMLTidy (http://www.egenix.com/files/python/mxTidy.html) > as a first step to get well formed HTML. But Tidy fails on huge numbers of real-world HTML pages. Simple things like misspelled tags make it fail: >>> from mx.Tidy import tidy >>> results = tidy("Hello world!"

Re: HTMLParser fragility

2006-04-07 Thread Richie Hindle
xes > up the mismatching tags. Great! Many thanks. -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: list.clear() missing?!?

2006-04-13 Thread Richie Hindle
[Mystilleef] > Lists should have a clear method. But what's shocking is that > it doesn't seem obvious to others. list.clear() is a whole lot more > readable, intuitive, "flowable" and desirable than [the alternatives] +1 to all of that. -- Richie Hind

<    1   2