Top and Bottom Values [PEP: 326]

2006-09-26 Thread Antoon Pardon
I know this PEP is rejected. However I have a problem that would benefit from having extreme values and the sample implementation that is given in the PEP is unsatifactory for my purpose. I had written my own module, which works similarly but is somewhat extended. Here is an example of how it can

Re: MySQLdb and mod_python issue

2006-09-26 Thread Steve Holden
Alvin Delagon wrote: > I have a mod_python script that is always crash while connecting to > mysql server. Here's a dump of the apache error log: > > [Wed Sep 27 13:27:42 2006] [notice] mod_python: (Re)importing module > 'test' with path set to '['/var/www/html/XBox2']' > [Wed Sep 27 13:27:42 20

Re: Makin search on the other site and getting data and writing in xml

2006-09-26 Thread Steve Holden
Lawrence D'Oliveiro wrote: > In message <[EMAIL PROTECTED]>, Steve > Holden wrote: > > >>The fact remains that Google can chop your searching ability off at the >>knees ... > > > No they can't. They can only chop off your ability to use Google. > [sigh]. Right, Lawrence, sorry I wasn't quite e

Re: Is there a regular expression for finding email address ?

2006-09-26 Thread Tim Roberts
"Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >Lad schrieb: >> Did anyone try to find out a regular expression for finding an email >> address in a text? >> Thank you for the reply > >Entering your subject line into google as it is, using the first result >found, you can get one. The OP should be

Contender for QOTW - Was : Re: AN Intorduction to Tkinter

2006-09-26 Thread Hendrik van Rooyen
"John Machin" <[EMAIL PROTECTED]> wrote: > In that case, don't burn bandwith by banal banter, post the examples! +1 here - Hendrik -- http://mail.python.org/mailman/listinfo/python-list

Re: a different question: can you earn a living with *just* python?

2006-09-26 Thread [EMAIL PROTECTED]
Roy Smith wrote: > "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > If you're really trying to become a well-rounded computer professional > > I'd recommend reasonable exposure to at least: > > > > * C > > * A static functional language (ML, Haskell, etc) > > * Lisp or scheme Scheme > > * A stati

Re: Computer Language Popularity Trend

2006-09-26 Thread Danno
Xah Lee wrote: > Computer Language Popularity Trend > > This page gives a visual report of computer languages's popularity, as > indicated by their traffic level in newsgroups. This is not a > comprehensive or fair survey, but does give some indications of > popularity trends. > > http://xahlee.or

MySQLdb and mod_python issue

2006-09-26 Thread Alvin Delagon
I have a mod_python script that is always crash while connecting to mysql server. Here's a dump of the apache error log:[Wed Sep 27 13:27:42 2006] [notice] mod_python: (Re)importing module 'test' with path set to '['/var/www/html/XBox2']' [Wed Sep 27 13:27:42 2006] [notice] child pid 27793 exit sig

Re: re.compile().split(): why it produces empty string as a first element of the list

2006-09-26 Thread alf
Fredrik Lundh wrote: > alf wrote: > >> Let's run following: >> >> >>> re.compile('(\[.*?\])').split('[aa]bb[11]22') >> ['', '[aa]', 'bb', '[11]', '22'] >> >> Why does it return '' as a first element of the list? > > > because the string starts with a separator. > > > so is it safe to say tha

Re: re.compile().split(): why it produces empty string as a first element of the list

2006-09-26 Thread Fredrik Lundh
alf wrote: > Let's run following: > > >>> re.compile('(\[.*?\])').split('[aa]bb[11]22') > ['', '[aa]', 'bb', '[11]', '22'] > > Why does it return '' as a first element of the list? because the string starts with a separator. -- http://mail.python.org/mailman/listinfo/python-list

Re: What's up with site.Quitter?

2006-09-26 Thread Fredrik Lundh
James Stroud wrote: > Yes, but I was speaking more consistency than convenience (see above for > what I mean by consistency). why would having access to a type object for exit/quit help you do proper syntax coloring, btw? if you want to generate a syntax table, wouldn't it be better to use th

re.compile().split(): why it produces empty string as a first element of the list

2006-09-26 Thread alf
Hi, Let's run following: >>> re.compile('(\[.*?\])').split('[aa]bb[11]22') ['', '[aa]', 'bb', '[11]', '22'] Why does it return '' as a first element of the list? Any insight? -- alf -- http://mail.python.org/mailman/listinfo/python-list

Re: What's up with site.Quitter?

2006-09-26 Thread James Stroud
Fredrik Lundh wrote: > James Stroud wrote: > >> It seems I can find a reference to just about every type except those >> for "exit" and "quit" in the standard library somewhere. E.g.: >> >> py> type(__builtins__.Ellipsis) is types.EllipsisType >> True >> >> However, in an appearant break with con

Re: What's up with site.Quitter?

2006-09-26 Thread Fredrik Lundh
James Stroud wrote: > It seems I can find a reference to just about every type except those > for "exit" and "quit" in the standard library somewhere. E.g.: > > py> type(__builtins__.Ellipsis) is types.EllipsisType > True > > However, in an appearant break with consistency, this can not be done

Re: IDLE - Customizing output format

2006-09-26 Thread James Stroud
Ilias Lazaridis wrote: > James Stroud wrote: >>Ilias Lazaridis wrote: >>>I am wondering that other users are not annoyed by this reduced >>>readability. >> >>I'm sure its quite unpopular to agree with you, but I do. I am >>tremendously annoyed the format of the interactive interpreter. Lovely >>wou

Re: does anybody earn a living programming in python?

2006-09-26 Thread Aahz
In article <[EMAIL PROTECTED]>, OKB (not okblacke) <[EMAIL PROTECTED]> wrote: > > This is interesting to me in that all these jobs also involve C. >I'm not the original poster, but I'd be interested to hear about people >who make a living programming Python WITHOUT knowing C. In more th

Re: optparse

2006-09-26 Thread Ben Finney
rick <[EMAIL PROTECTED]> writes: > usage: DelimTOFixedWidth.py [options] That's not the command-line argument style that optparse models. It should be: command_name [options] In other words, the options (optionally) appear before the non-option arguments. This is the convention followed

Starting Win32 Service

2006-09-26 Thread placid
Hi all, Using Tim Golden's wmi module you can get the service names import wmi c = wmi.WMI () stopped_services = c.Win32_Service (StartMode="Auto", State="Stopped") if stopped_services: for s in stopped_services: print s.Caption, "service is not running" else: print "No auto services stop

optparse

2006-09-26 Thread rick
Consider the following piece of code: parser = optparse.OptionParser(usage="usage: %prog [options]", add_help_option=False) parser.add_option("-d", type="string", action="store", dest="DELIM", default="|", help="single character delimiter in quotes (default: |)") (options, args) = parser.parse

Re: Makin search on the other site and getting data and writing in xml

2006-09-26 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Steve Holden wrote: > The fact remains that Google can chop your searching ability off at the > knees ... No they can't. They can only chop off your ability to use Google. -- http://mail.python.org/mailman/listinfo/python-list

Re: Making search on the other site and getting data and writing in xml

2006-09-26 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Steven D'Aprano wrote: > If Google wants to write legal > contracts that won't stand up in court (speaking as somebody who isn't a > lawyer and whose legal advice is worthless), they can. What they define as their terms of service doesn't have to stand up in court.

Re: problem moving from char to integer

2006-09-26 Thread Melih Onvural
I'm trying to calculate the checksum of a website so that I can get its PageRank. I'm modifying the code that I found here: http://blog.outer-court.com/archive/2004_06_27_index.html#108834386239051706 I apologize for being secretive, but I didn't mean to be. I'm trying to take characters and push

What's up with site.Quitter?

2006-09-26 Thread James Stroud
Hello All, Still jubilantly configuring my work environment for python 2.5, I came accross a curiosity when writing an automatic vim syntax file creator (so I can automatically update my syntax coloring with future python releases). It seems I can find a reference to just about every type exce

Re: does anybody earn a living programming in python?

2006-09-26 Thread OKB (not okblacke)
wesley chun wrote: > since 1997, i've been pretty much working full-time in Python: > - at yahoo, we developed yahoo!mail in python (and some C++) > - at synarc, i wrote software for doctors in python (and some C) > - at ironport, most everything is in python (and some C, PyRex). we > have a milli

Re: preserving color ouput of a shell command via os.popen()

2006-09-26 Thread Gabriel Genellina
At Tuesday 26/9/2006 23:07, [EMAIL PROTECTED] wrote: I would like to get the output of a shell process on Linux (eg, "ls --color=auto") run via os.popen(), filter it and then output parts of it while preserving any original coloring added by that process. Yes, just omit the =auto (or use --col

Re: A critique of cgi.escape

2006-09-26 Thread Anthony Baxter
> I would really rather this were a discussion than an argument. You will > now no doubt reply telling me I wouldn't. > > My posting was issued as a response to the irritation engendered by your > argumentative style of debate. Your latest response simply proves that > there is indeed no remark, ho

How to apply text changes to HTML, keeping it intact if inside "a" tags

2006-09-26 Thread vbfoobar
Hello, I have HTML input to which I apply some changes. Feature 1: === I want to tranform all the text, but if the text is inside an "a href" tag, I want to leave the text as it is. The HTML is not necessarily well-formed, so I would like to do that using BeautifulSoup (or maybe another tole

Re: Survival of the fittest

2006-09-26 Thread MonkeeSage
James Stroud wrote: > Out of curiosity, what are these features that ruby has that python > lacks. I've always wondered whether I should look at ruby--whether, as a > language, it has anything to teach me that say python, C, and Java don't > (LISP/Scheme is on my short-list to learn.) Just a guess

Re: preserving color ouput of a shell command via os.popen()

2006-09-26 Thread Jean-Paul Calderone
On 26 Sep 2006 19:07:54 -0700, [EMAIL PROTECTED] wrote: >Hi everyone > >I would like to get the output of a shell process on Linux (eg, "ls >--color=auto") run via os.popen(), filter it and then output parts of >it while preserving any original coloring added by that process. > >Doing > >child = os

Re: Survival of the fittest

2006-09-26 Thread Thomas Bartkus
On Wed, 27 Sep 2006 01:51:43 +0200, baalbek wrote: > Now, six years later, I use Python for about 70-80% of all my work (the > remainder being Ruby and C/C++). > > I'm now having the policy: "If it's doable in Python, I'll use Python". Okay. How did your stated "policy" leave you still wasti

Re: A critique of cgi.escape

2006-09-26 Thread Steve Holden
Lawrence D'Oliveiro wrote: > In message <[EMAIL PROTECTED]>, Steve > Holden wrote: > > >>Lawrence D'Oliveiro wrote: >> >>>In message <[EMAIL PROTECTED]>, Georg Brandl wrote: >>> >>> >>> Lawrence D'Oliveiro wrote: >In message <[EMAIL PROTECTED]>, Georg Brandl wrote: > > >

Re: preserving color ouput of a shell command via os.popen()

2006-09-26 Thread zeezlo
> See the difference? :) Brett, not only do I see the difference but I actually see it in color, too! : ) Thanks for your help, Juerg -- http://mail.python.org/mailman/listinfo/python-list

Computer Language Popularity Trend

2006-09-26 Thread Xah Lee
Computer Language Popularity Trend This page gives a visual report of computer languages's popularity, as indicated by their traffic level in newsgroups. This is not a comprehensive or fair survey, but does give some indications of popularity trends. http://xahlee.org/lang_traf/index.html Xah

Re: preserving color ouput of a shell command via os.popen()

2006-09-26 Thread Brett Hoerner
[EMAIL PROTECTED] wrote: > child = os.popen("ls --color=auto") > output = child.read() > > results in an output string which is free of the escape sequences > generated by ls. Don't use --color=auto, from the 'ls' man page: With --color=auto, color codes are output only if standard output is co

Re: releasing memory to malloc

2006-09-26 Thread Paul Rubin
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 in a C extension. The Pyth

Re: A critique of cgi.escape

2006-09-26 Thread George Sakkis
Lawrence D'Oliveiro wrote: > In message <[EMAIL PROTECTED]>, George > Sakkis wrote: > > > Lawrence D'Oliveiro wrote: > > > >> Fredrik Lundh wrote: > >> > you're not the designer... > >> > >> I don't have to be. Whoever the designer was, they had not properly > >> thought through the uses of this f

preserving color ouput of a shell command via os.popen()

2006-09-26 Thread zeezlo
Hi everyone I would like to get the output of a shell process on Linux (eg, "ls --color=auto") run via os.popen(), filter it and then output parts of it while preserving any original coloring added by that process. Doing child = os.popen("ls --color=auto") output = child.read() results in an ou

Re: releasing memory to malloc

2006-09-26 Thread iker . arizmendi
I happen to have the code for the C library in question, but I don't think this is the way to go in general. If there's a way to get Python to give memory back to the C allocator I can avoid touching the library at all. Regards, Iker John Machin wrote: > [EMAIL PROTECTED] wrote: > > I can, but t

Re: releasing memory to malloc

2006-09-26 Thread Gabriel Genellina
At Tuesday 26/9/2006 22:17, [EMAIL PROTECTED] wrote: I can, but the extension is only a thin wrapper around a general purpose C library which is also used independently of Python. If you can recompile a specific version for using with Python, you can play with a few macros like #ifdef USE_P

Re: A critique of cgi.escape

2006-09-26 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Fredrik Lundh wrote: > most HTML attributes cannot even contain things that would need > to be escaped ... sys.stdout.write \ ( "Email: \n" % QuoteHTML(WhateverTheUserPreviouslyTyped) ) -- http://mail.python.org/mailman/listinfo/python-list

Re: Makin search on the other site and getting data and writing in xml

2006-09-26 Thread George Sakkis
[EMAIL PROTECTED] wrote: > I dont mean google > i dont mean onelook.com > > these are only examples > > i hop eyou understand what i mean Apparently, *you* don't understand what they're trying to tell you. It roughly boils down to the following: - All (except perhaps the most trivial small) site

Re: releasing memory to malloc

2006-09-26 Thread John Machin
[EMAIL PROTECTED] wrote: > I can, but the extension is only a thin wrapper around a general > purpose C library which is also used independently of Python. > So change the library to use xmalloc etc and add something like this to the .h file: #ifdef PYMEM #define xmalloc PyMem_Malloc etc #else #

Re: Survival of the fittest

2006-09-26 Thread Ben Finney
baalbek <[EMAIL PROTECTED]> writes: > This unassuming scripting language has beaten heavy-weights like > Java, C++, etc, and this without any serious marketing machine > behind it. > > Why? The language is just so well designed (I miss some of Ruby's > features, but then, nothing is perfect), robu

Re: Survival of the fittest

2006-09-26 Thread James Stroud
baalbek wrote: > Why? The language is just so well designed (I miss some of Ruby's > features, but then, nothing is perfect) Out of curiosity, what are these features that ruby has that python lacks. I've always wondered whether I should look at ruby--whether, as a language, it has anything to

Re: releasing memory to malloc

2006-09-26 Thread iker . arizmendi
I can, but the extension is only a thin wrapper around a general purpose C library which is also used independently of Python. Iker Gabriel Genellina wrote: > Can you modify the C source? If you can, use the Python memory > allocation functions PyMem_Malloc/PyMem_Realloc/PyMem_Free. > > > > Gabr

Re: releasing memory to malloc

2006-09-26 Thread Gabriel Genellina
At Tuesday 26/9/2006 21:34, [EMAIL PROTECTED] 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

Dr. Dobb's Python-URL! - weekly Python news and links (Sep 27)

2006-09-26 Thread Cameron Laird
QOTW: "It's not out of the kindness of our hearts that we help. Heck, I don't know what it is. Probably I just like reading my own drivel on the internet and occasionally helping others is a good excuse." - Neil Cerutti "Well, if you're only watching mtv, it's easy to think that there's obviou

Re: releasing memory to malloc

2006-09-26 Thread John Machin
[EMAIL PROTECTED] 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 in a C extens

Re: A critique of cgi.escape

2006-09-26 Thread John Bokma
Lawrence D'Oliveiro <[EMAIL PROTECTED]> wrote: > In message <[EMAIL PROTECTED]>, John Bokma > wrote: [..] >> ... href="/search.cgi?query=3&results=10" > > You _do_ realize that the "&" should be escaped as "&", don't you? And what's "/search.cgi?query=3&results=10"? An attribute value. Exac

Re: A critique of cgi.escape

2006-09-26 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, George Sakkis wrote: > Lawrence D'Oliveiro wrote: > >> Fredrik Lundh wrote: >> > you're not the designer... >> >> I don't have to be. Whoever the designer was, they had not properly >> thought through the uses of this function. That's quite obvious already, >> to a

Re: A critique of cgi.escape

2006-09-26 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Gabriel G wrote: > At Tuesday 26/9/2006 04:16, Lawrence D'Oliveiro wrote: > >> >> >> What precisely do you think it would "break"? >> > FWIW, a *lot* of unit tests on *my* generated html code would break... >>Why did you write your code that way? > > Uhm, maybe be

Re: A critique of cgi.escape

2006-09-26 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Fredrik Lundh wrote: > Lawrence D'Oliveiro wrote: > >>> (cgi.escape(s, True) is slower than cgi.escape(s), for reasons that are >>> obvious for anyone who's looked at the code). >> >> What you're doing is adding to the reasons why the existing cgi.escape >> functio

Re: A critique of cgi.escape

2006-09-26 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Steve Holden wrote: > Lawrence D'Oliveiro wrote: >> In message <[EMAIL PROTECTED]>, Georg Brandl wrote: >> >> >>>Lawrence D'Oliveiro wrote: >>> In message <[EMAIL PROTECTED]>, Georg Brandl wrote: >Lawrence D'Oliveiro wrote: > >>In message

Re: A critique of cgi.escape

2006-09-26 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, John Bokma wrote: > Brian Quinlan <[EMAIL PROTECTED]> wrote: > >> o escaping attribute values is less common than escaping element >>text > > Again, you must be kidding... I don't think Brian Quinlan was seriously trying to claim that was true, only that was

releasing memory to malloc

2006-09-26 Thread iker . arizmendi
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 in a C extension. The Python objects consume quite

Re: A critique of cgi.escape

2006-09-26 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Fredrik Lundh wrote: > Jon Ribbens wrote: > >> This has nothing to do with character encodings. > > it has *everything* to do with encoding of existing data into HTML so it > can be safely transported to, and recreated by, an HTML-aware client. > > does the word

Re: AN Intorduction to Tkinter

2006-09-26 Thread John Machin
[EMAIL PROTECTED] wrote: > > Tis question was just asked on the py2exe mailing list. I predicted > > that if it was asked here, you would respond asking exactly which > > examples didn't work. :-p > > Right you were :-) > > Just want to learn what I already know as a great programming > interface(

Re: AN Intorduction to Tkinter

2006-09-26 Thread [EMAIL PROTECTED]
> Tis question was just asked on the py2exe mailing list. I predicted > that if it was asked here, you would respond asking exactly which > examples didn't work. :-p Right you were :-) Just want to learn what I already know as a great programming interface(?)/language... Tanner -- http://mail.

Re: Python CTypes translation of (pv != NULL)

2006-09-26 Thread Gabriel Genellina
At Tuesday 26/9/2006 16:00, [EMAIL PROTECTED] wrote: > >Q: The C idea of (pv != NULL) is said most directly in Python ctypes > >how? > > Perhaps reading the ctypes tutorial? (both in the 2.5 docs and in > ) Actually, no. I see three

Re: a different question: can you earn a living with *just* python?

2006-09-26 Thread Roy Smith
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > If you're really trying to become a well-rounded computer professional > I'd recommend reasonable exposure to at least: > > * C > * A static functional language (ML, Haskell, etc) > * Lisp or scheme Scheme > * A static class-oriented language (Java

Re: problem moving from char to integer

2006-09-26 Thread John Machin
Melih Onvural wrote: > This is the error message that I'm having a tough time interpreting: > Traceback (most recent call last): > File "pagerank.py", line 101, in ? > main() > File "pagerank.py", line 96, in main > ch = strord(url) > File "pagerank.py", line 81, in strord > resu

Survival of the fittest

2006-09-26 Thread baalbek
I first heard of Python (on a CD cover) back in 1995. I thought, "what is this? Python? Forget about it!" Back then, I was a huge fan of the Delphi (Object Pascal) language, and had immense respect for the C/C++ family. 1997 I got seriously into C++ programming, and thought, "could anything be

Re: Running Python script from C++ code(.NET)

2006-09-26 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, volcano <[EMAIL PROTECTED]> wrote: . . . >But here is another question for gurus: sometimes my script fails, and >I cannot figure out why. OK, I can - especially since I terminate it >with "sys.e

Re: QuoteSQL

2006-09-26 Thread Steve Holden
Lawrence D'Oliveiro wrote: > In message <[EMAIL PROTECTED]>, Steve > Holden wrote: [...] >>Sadly your assertions alone fail to convince. Perhaps you could provide >>a concrete example? > > > Sorry, that turned out to be wrong. You do in fact need to escape the > escapes on wildcards. Thank you.

Re: Makin search on the other site and getting data and writing in xml

2006-09-26 Thread altemurbugra
I dont mean google i dont mean onelook.com these are only examples i hop eyou understand what i mean -- http://mail.python.org/mailman/listinfo/python-list

Re: a different question: can you earn a living with *just* python?

2006-09-26 Thread Roy Smith
John Salerno <[EMAIL PROTECTED]> wrote: > But what if you are an expert Python program and have zero clue about > other languages? Can you still earn a living that way, or do most/all > companies require multiple language proficiency? Nobody likes a one-trick pony. -- http://mail.python.org/mai

Re: problem moving from char to integer

2006-09-26 Thread Larry Bates
Melih Onvural wrote: > This is the error message that I'm having a tough time interpreting: > Traceback (most recent call last): > File "pagerank.py", line 101, in ? > main() > File "pagerank.py", line 96, in main > ch = strord(url) > File "pagerank.py", line 81, in strord > resul

Re: f2py on windows tutorials

2006-09-26 Thread Robert Kern
Robert Kern wrote: > Flavio wrote: >> Thank you Robert, >> >> I was surprised that the setup.py was virtually identical to the one I >> use for Linux. However I was not at all surprised when it didn't work. >> ;-) >> >> It complains it can't find msvc: >> >> No module named msvccompiler in numpy.di

Re: IDLE - Customizing output format

2006-09-26 Thread Gabriel Genellina
At Tuesday 26/9/2006 15:29, Ilias Lazaridis wrote: > >>> def f(obj): > print '' + repr(obj) > > >>> sys.displayhook = f I've placed this code within /Lib/sitecustomize.py, but have one strange result: >>> from talker import * >>> t = Talker() >>> t.sayHello : > >>> t.sayHello() H

Re: f2py on windows tutorials

2006-09-26 Thread Robert Kern
Flavio wrote: > Thank you Robert, > > I was surprised that the setup.py was virtually identical to the one I > use for Linux. However I was not at all surprised when it didn't work. > ;-) > > It complains it can't find msvc: > > No module named msvccompiler in numpy.distutils, trying from > dist

Re: IDLE - Customizing output format

2006-09-26 Thread Gabriel Genellina
At Tuesday 26/9/2006 15:31, Ilias Lazaridis wrote: > >Anyways, against my better judgement, I will tell you that you can > >customize the > >output by replacing sys.displayhook with your own function: > > > >http://www.python.org/doc/current/lib/module-sys.html > > > > >>> import sys > > >

Re: problem moving from char to integer

2006-09-26 Thread Melih Onvural
This is the error message that I'm having a tough time interpreting: Traceback (most recent call last): File "pagerank.py", line 101, in ? main() File "pagerank.py", line 96, in main ch = strord(url) File "pagerank.py", line 81, in strord result[counter] = int(i); ValueError: inva

Re: problem moving from char to integer

2006-09-26 Thread Pontus Ekberg
Melih Onvural wrote: > Group, > > I'm trying to get a very basic cast from a string to an integer > working. Here is what I'm doing: > > for i in url: > result[counter] = int(i) > counter += 1; > > return result; > > anything that I'm doing drastically wrong? Mac OS 10.4, MacPython >

Re: A critique of cgi.escape

2006-09-26 Thread John Bokma
Brian Quinlan <[EMAIL PROTECTED]> wrote: > A summary of this pointless argument: > > Why cgi.escape should be changed to escape double quote (and maybe > single quote) characters by default: > o escaping should be very aggressive by default to avoid subtle bugs > o over-escaping is not likely

problem moving from char to integer

2006-09-26 Thread Melih Onvural
Group, I'm trying to get a very basic cast from a string to an integer working. Here is what I'm doing: for i in url: result[counter] = int(i) counter += 1; return result; anything that I'm doing drastically wrong? Mac OS 10.4, MacPython upgraded to 2.4. Thanks for any help, Melih -

Re: shlex.split != shlex.shlex get_token til eof

2006-09-26 Thread p . lavarre
Correspondingly, to the Faq Wiki I added: /// http://pyfaq.infogami.com/installed-index Q: Where is Python installed on my machine? A: Binaries in bin/, source in lib/, doc somewhere else. Read the module source when you find its doc incomplete. On Linux, ... On the Mac, straight from Apple: /

Re: a different question: can you earn a living with *just* python?

2006-09-26 Thread Ben Finney
Richard Jones <[EMAIL PROTECTED]> writes: > John Salerno wrote: > > But what if you are an expert Python program and have zero clue > > about other languages? Can you still earn a living that way, or do > > most/all companies require multiple language proficiency? > > These are separate questions.

Re: A critique of cgi.escape

2006-09-26 Thread Gabriel G
At Tuesday 26/9/2006 12:53, Jon Ribbens wrote: > BTW, I am curious about how you do unit testing. The example that I used > in my summary is a very common pattern but would break in cgi.escape > changed it's semantics. What do you do instead? To be honest I'm not sure what *sort* of code people

Re: does anybody earn a living programming in python?

2006-09-26 Thread Andy Dingley
walterbyrd wrote: > If so, I doubt there are many. I currently earn my living "programming in Python". This is particularly amusing given that it's a Java shop and I don't even know Python! I've only been using it for a few months as a replacement for the previous shell scripts and instead of

Re: shlex.split != shlex.shlex get_token til eof

2006-09-26 Thread p . lavarre
Kindly offline the answer is: (a) Python installation usually includes source, and thus (b) UTSL: $ pwd C:\Python25\Lib\shlex.py $ ... $ pwd /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5 $ grep -A 5 "def split" shlex.py def split(s, comments=False): lex = shlex(s, posix=True

Re: a different question: can you earn a living with *just* python?

2006-09-26 Thread Ben Finney
John Salerno <[EMAIL PROTECTED]> writes: > But what if you are an expert Python program and have zero clue > about other languages? Can you still earn a living that way, or do > most/all companies require multiple language proficiency? I certainly wouldn't hire someone, for any programming team I

Re: a different question: can you earn a living with *just* python?

2006-09-26 Thread Fuzzyman
John Salerno wrote: > It's a nice thought that a person can earn a living programming with > Python, which is fun enough to use just for its own sake. But for > someone like me (i.e. no programming experience) it's always a little > disheartening to see that most (if not all) job descriptions that

Re: for: else: - any practical uses for the else clause?

2006-09-26 Thread Fuzzyman
Amaury Forgeot d'Arc wrote: > [EMAIL PROTECTED] a écrit : > > A very old thread: > > http://groups.google.com/group/comp.lang.python/browse_frm/thread/2c5022e2b7f05525/1542d2041257c47e?lnk=gst&q=for+else&rnum=9#1542d2041257c47e > > > > discusses the optional "else:" clause of the for statement. >

Re: for: else: - any practical uses for the else clause?

2006-09-26 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > A very old thread: > http://groups.google.com/group/comp.lang.python/browse_frm/thread/2c5022e2b7f05525/1542d2041257c47e?lnk=gst&q=for+else&rnum=9#1542d2041257c47e > > discusses the optional "else:" clause of the for statement. > > I'm wondering if anyone has ever fo

Re: 2.5 updates for syntax file

2006-09-26 Thread Fuzzyman
Grzegorz Makarewicz wrote: > Andrea wrote: > >> Hi everyone. I'm updating my UltraEdit syntax file for Python 2.5 and > >> was wondering if anyone knew of other additions to make besides these. I > >> found all of these in the What's New document, but wasn't sure if there > >> were other important

Re: AN Intorduction to Tkinter

2006-09-26 Thread Fuzzyman
Fredrik Lundh wrote: > [EMAIL PROTECTED] wrote: > > > I know that the most known tkinter intro guide at the time is "An > > Intorduction to Tkinter" by Frederick Lundh, but after trying some of > > the examples, I noticed that they did not work > > what examples are this ? are you sure it's not a

Re: a different question: can you earn a living with *just* python?

2006-09-26 Thread Richard Jones
John Salerno wrote: > But what if you are an expert Python program and have zero clue about > other languages? Can you still earn a living that way, or do most/all > companies require multiple language proficiency? These are separate questions. I know a dozen languages but I'm only required to kno

Re: Win32: Access to network resources w/o user login

2006-09-26 Thread Roger Upole
"utabintarbo" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Is there a way to (programmatically) access network resources from a > WinXP client without a user being logged in? I guess I need to know > where the fstab file is in Windows. :-P > > Some more background: I am trying to

Re: ruby %w equivalent

2006-09-26 Thread Thorsten Kampe
* Antoine De Groote (Tue, 26 Sep 2006 12:06:38 +0200) >Thorsten Kampe wrote: >> * John Machin (24 Sep 2006 15:32:20 -0700) >>> Antoine De Groote wrote: is there a python equivalent for the ruby %w operator? %w{a b c} creates an array with strings "a", "b", and "c" in ruby... >>> | >>

Re: Surprise using the 'is' operator

2006-09-26 Thread wesley chun
> "Terry Reedy" <[EMAIL PROTECTED]> wrote: > > as a side note, the ints that are cached (for current versions of > > Python) are in range(-1, 100)... is this documented somewhere? > Not true for at least 2.4 and 2.5. The cached range has expanded oops, apologies to all... it really *is* subject t

Re: where are isinstance types documented?

2006-09-26 Thread John Machin
Georg Brandl wrote: > Fredrik Lundh wrote: > > Sion Arrowsmith wrote: > >> > > > >>> based on http://docs.python.org/ref/types.html, here's a list of the > >>> most commonly used core types: > >>> [ ... ] > >>> Sequences: > >>> str > >>> unicode > >>> tuple > >>> list > >> > >> And

Re: Unexpected behaviour of csv module

2006-09-26 Thread John Machin
Andrew McLean wrote: > John Machin wrote: > > You can fix that. The beauty of open source is that you can grab it > > (Windows: c:\python2?\lib\csv.py (typically)) and hack it about till it > > suits your needs. Go fer it! > > Unfortunately the bits I should change are in _csv.c We must be talking

Re: a different question: can you earn a living with *just* python?

2006-09-26 Thread [EMAIL PROTECTED]
John Salerno wrote: > It's a nice thought that a person can earn a living programming with > Python, which is fun enough to use just for its own sake. But for > someone like me (i.e. no programming experience) it's always a little > disheartening to see that most (if not all) job descriptions that

Re: A critique of cgi.escape

2006-09-26 Thread Gabriel G
At Tuesday 26/9/2006 04:16, Lawrence D'Oliveiro wrote: >> >> What precisely do you think it would "break"? > FWIW, a *lot* of unit tests on *my* generated html code would break... Why did you write your code that way? Uhm, maybe because I relied on the published documentation of a published s

Re: Reading a file using a UNC - help!

2006-09-26 Thread richard . kessler
Thanks very much all for respondingI got it working. As you indicated, I just had mixed up my escapes (//) with my \n. When I got the correct amount of backslashes and removed the linefeeds it worked great. Thanks again. -- http://mail.python.org/mailman/listinfo/python-list

Re: Whither binary search?

2006-09-26 Thread John Machin
Fredrik Lundh wrote: > Neil Cerutti wrote: > > >> bisect... > > > > That doesn't tell me if an item doesn't exist in the sequence > > though, does it? Maybe I'm being dense. > > I guess you could use something like > > import bisect > > def check(list, item): > try: > return list[bisec

Re: QuoteSQL

2006-09-26 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Steve Holden wrote: > Lawrence D'Oliveiro wrote: > >> In message <[EMAIL PROTECTED]>, Duncan Booth wrote: >> >>>In particular it currently turns newlines in backslash followed by n >>>which (since MySQL ignores the extra backslash escape) is equivalent to >>>turnin

Re: QuoteSQL

2006-09-26 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Steve Holden wrote: > Lawrence D'Oliveiro wrote: >> In message <[EMAIL PROTECTED]>, Steve >> Holden wrote: >> >> >>>Lawrence D'Oliveiro wrote: >>> In message <[EMAIL PROTECTED]>, Steve Holden wrote: >When you use the DB API correctly and

Re: QuoteSQL

2006-09-26 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Sybren Stuvel wrote: > Tim Chase enlightened us with: >> >>> cur.execute("select * from people where last_name in (%s)" % >> ','.join('%s' for i in xrange(len(t))), >> t) > > But since the value of 'i' isn't used at all, it can be abbreviated > to: > cur.exec

Re: for: else: - any practical uses for the else clause?

2006-09-26 Thread Amaury Forgeot d'Arc
[EMAIL PROTECTED] a écrit : > A very old thread: > http://groups.google.com/group/comp.lang.python/browse_frm/thread/2c5022e2b7f05525/1542d2041257c47e?lnk=gst&q=for+else&rnum=9#1542d2041257c47e > > discusses the optional "else:" clause of the for statement. > > I'm wondering if anyone has ever fo

  1   2   3   4   >