Re: ANN: equivalence 0.1

2008-06-02 Thread Giuseppe Ottaviano
Interesting.. it took me a while to figure out why the second case is so much slower and you're right, it is indeed quadratic. I don't know how likely would such pathological cases be in practice, given that the preferred way to merge a batch of objects is eq.merge(*xrange(10001)), which is more

Re: Better performance

2008-06-02 Thread Arnaud Delobelle
Franck Y <[EMAIL PROTECTED]> writes: > Hello Folks, > > I am facing a problem where i need to parse around 200 files, i have a > bit of knowledge in PHP/Perl/Python (the magic P :-P) > > Which one would you suggest me since i have to generate a web > interface ? > And each one has his area of 'wo

Re: Python's doc problems: sort

2008-06-02 Thread szr
szr wrote: > Jürgen Exner wrote: >> "Andrew Koenig" <[EMAIL PROTECTED]> wrote: >>> <[EMAIL PROTECTED]> wrote in message >> >> [Subject: Python's doc problems: sort] I want to emphasize a point here, as i have done quite emphatically in the past. The Python documentation, is the world's

platypus in page header

2008-06-02 Thread Laszlo Nagy
Is it possible to use platypus in page header and footer? I need to create a document with long paragraphs but also I need to put tables and images in page header and multi line info in page footer with alignment etc. Thanks, Laszlo -- http://mail.python.org/mailman/listinfo/python-list

Re: The Importance of Terminology's Quality

2008-06-02 Thread szr
Arne Vajhøj wrote: > szr wrote: >> Arne Vajhøj wrote: >>> szr wrote: Peter Duniho wrote: > On Fri, 30 May 2008 22:40:03 -0700, szr <[EMAIL PROTECTED]> > wrote: >> Arne Vajhøj wrote: >>> Stephan Bour wrote: Lew wrote: } John Thingstad wrote: } > Perl i

Re: Better performance

2008-06-02 Thread Bruno Desthuilliers
Franck Y a écrit : Hello Folks, I am facing a problem where i need to parse around 200 files, i have a bit of knowledge in PHP/Perl/Python (the magic P :-P) Which one would you suggest me since i have to generate a web interface ? And each one has his area of 'work' And where's your perform

printf in python

2008-06-02 Thread gianluca
Hy, I've a problem with may python library generated with swig from C code. I works and I can access all function but a simèple function that print a string don't work's. The function is like this: int PrintTEST() { printf("TEST "); return 1; } If I call the function (myDLL.PrintTEST()

Re: php vs python

2008-06-02 Thread Arnaud Delobelle
"Joel Koltner" <[EMAIL PROTECTED]> writes: > There's potentially a large difference between a "good" speaker of > English/German/etc. vs. "eloquent." > > I'd tend to agree with Jerry that if you can write "good" code in > one language, you can in pretty much any other as well... but that > doesn'

Formatting Output

2008-06-02 Thread [EMAIL PROTECTED]
Hi, i am building a little script and i want to output a series of columns more or less like this: 1 5 6 2 2 8 2 9 5 The matter is that i don't know in advance how many columns there will be. By the way, each column will be actually FLOATs, not INTs. How can i do this ? Any help welcome. R

Re: php vs python

2008-06-02 Thread Duncan Booth
Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > I find that eloquent Python speakers often tend to write a for loop > when mere good ones will try to stick a list comprehension in! > +1 QOTW -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Writing HTML

2008-06-02 Thread miller . paul . w
I've searched the standard library docs, and, while there are a couple options for *reading* HTML from Python, I didn't notice any for *writing* it. Does anyone have any recommendations (particularly ones not listed on PyPI)? Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: printf in python

2008-06-02 Thread Hrvoje Niksic
gianluca <[EMAIL PROTECTED]> writes: > Hy, I've a problem with may python library generated with swig from C > code. I works and I can access all function but a simèple function > that print a string don't work's. > The function is like this: > int PrintTEST() > { > printf("TEST "); > r

How "solid" is PyPy?

2008-06-02 Thread miller . paul . w
I've been looking at PyPy recently, and I see it's reached version 1.0 (and supports language version 2.4). Given that, I was wondering what level of backwards-compatibility one can expect from future versions, i.e. if I run code on, say, a translated stackless PyPy now, what is the probability th

Re: Writing HTML

2008-06-02 Thread Marc 'BlackJack' Rintsch
On Mon, 02 Jun 2008 01:03:05 -0700, miller.paul.w wrote: > I've searched the standard library docs, and, while there are a couple > options for *reading* HTML from Python, I didn't notice any for > *writing* it. I guess that's where the many templating engines are used. Ciao, Marc 'Black

Re: Formatting Output

2008-06-02 Thread Marc 'BlackJack' Rintsch
On Mon, 02 Jun 2008 00:34:09 -0700, [EMAIL PROTECTED] wrote: > i am building a little script and i want to output a series of columns > more or less like this: > > 1 5 6 > 2 2 8 > 2 9 5 > > The matter is that i don't know in advance how many columns there will > be. By the way, each column

Re: Formatting Output

2008-06-02 Thread Chris
On Jun 2, 9:34 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi, > > i am building a little script and i want to output a series of columns > more or less like this: > > 1  5  6 > 2  2  8 > 2  9  5 > > The matter is that i don't know in advance how many columns there will > be. By the way, e

Re: Why does python not have a mechanism for data hiding?

2008-06-02 Thread Antoon Pardon
On 2008-05-24, Ben Finney <[EMAIL PROTECTED]> wrote: > Sh4wn <[EMAIL PROTECTED]> writes: > >> first, python is one of my fav languages, and i'll definitely keep >> developing with it. But, there's 1 one thing what I -really- miss: >> data hiding. I know member vars are private when you prefix them

Re: Why does python not have a mechanism for data hiding?

2008-06-02 Thread Antoon Pardon
On 2008-05-24, Sh4wn <[EMAIL PROTECTED]> wrote: > Hi, > > first, python is one of my fav languages, and i'll definitely keep > developing with it. But, there's 1 one thing what I -really- miss: > data hiding. I know member vars are private when you prefix them with > 2 underscores, but I hate prefi

Re: Why does python not have a mechanism for data hiding?

2008-06-02 Thread Duncan Booth
Antoon Pardon <[EMAIL PROTECTED]> wrote: > If you really need it, you can do data hiding in python. It just > requires a bit more work. > --- $ python > Python 2.5.2 (r252:60911, Apr 17 2008, 13:15:05) > [GCC 4.2.3 (Debian 4.2.3-3)] on linux2 > Type "help", "copyright", "credits" or "license" fo

Re: Why does python not have a mechanism for data hiding?

2008-06-02 Thread Carl Banks
On Jun 2, 5:38 am, Antoon Pardon <[EMAIL PROTECTED]> wrote: > If you really need it, you can do data hiding in python. It just > requires a bit more work. > > - Hide.py - > class Rec(object): > def __init__(__, **kwargs): > f

Re: Writing HTML

2008-06-02 Thread Ken Starks
[EMAIL PROTECTED] wrote: I've searched the standard library docs, and, while there are a couple options for *reading* HTML from Python, I didn't notice any for *writing* it. Does anyone have any recommendations (particularly ones not listed on PyPI)? Thanks My approach is usually to write the

Re: Writing HTML

2008-06-02 Thread miller . paul . w
On Jun 2, 6:11 am, Ken Starks <[EMAIL PROTECTED]> wrote: > My approach is usually to write the data-load in XML rather than > directly in HTML, and then use XSLT to produce the (X)HTML. That's a good idea I hadn't considered. Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Shed my a light :)

2008-06-02 Thread TheSaint
Hi, I using eval for quite strange reason, as long as I don't know a different way to implement. An example: actions= ('print', 'sum', 'divide', 'myfunction') parameters=(5, 'nothing',5.63, object) for routines in actions: routines(parameters) I'd like to note that actions are string or st

Re: Why does python not have a mechanism for data hiding?

2008-06-02 Thread Antoon Pardon
On 2008-06-02, Duncan Booth <[EMAIL PROTECTED]> wrote: > Antoon Pardon <[EMAIL PROTECTED]> wrote: > >> If you really need it, you can do data hiding in python. It just >> requires a bit more work. > >> --- $ python >> Python 2.5.2 (r252:60911, Apr 17 2008, 13:15:05) >> [GCC 4.2.3 (Debian 4.2.3-3)]

Re: Why does python not have a mechanism for data hiding?

2008-06-02 Thread Antoon Pardon
On 2008-06-02, Carl Banks <[EMAIL PROTECTED]> wrote: > On Jun 2, 5:38 am, Antoon Pardon <[EMAIL PROTECTED]> wrote: >> If you really need it, you can do data hiding in python. It just >> requires a bit more work. >> >> - Hide.py - >> class

Re: Shed my a light :)

2008-06-02 Thread Chris
On Jun 2, 12:35 pm, TheSaint <[EMAIL PROTECTED]> wrote: > Hi, > I using eval for quite strange reason, as long as I don't know a different > way to implement. > > An example: > > actions= ('print', 'sum', 'divide', 'myfunction') > parameters=(5, 'nothing',5.63, object) > > for routines in actions:

Re: Shed my a light :)

2008-06-02 Thread Duncan Booth
TheSaint <[EMAIL PROTECTED]> wrote: > actions= ('print', 'sum', 'divide', 'myfunction') > parameters=(5, 'nothing',5.63, object) > > for routines in actions: > routines(parameters) > > I'd like to note that actions are string or string expressions of the > program functions or python itself

mocking a logging object

2008-06-02 Thread Peter Bengtsson
In my unittest I want to override the logger of a working module so that it puts all logging messages in /tmp/test.log instead so that in my unittest I can inspect that it logs things correctly. Hopefully this "pseudo" code will explain my problem:: >>> import logging, os >>> logging.basicConfig(f

Re: mocking a logging object

2008-06-02 Thread Diez B. Roggisch
Peter Bengtsson wrote: > In my unittest I want to override the logger of a working module so > that it puts all logging messages in /tmp/test.log instead so that in > my unittest I can inspect that it logs things correctly. Hopefully > this "pseudo" code will explain my problem:: > import lo

Re: Why does python not have a mechanism for data hiding?

2008-06-02 Thread Carl Banks
On Jun 2, 6:40 am, Antoon Pardon <[EMAIL PROTECTED]> wrote: > On 2008-06-02, Carl Banks <[EMAIL PROTECTED]> wrote: > > > > > On Jun 2, 5:38 am, Antoon Pardon <[EMAIL PROTECTED]> wrote: > >> If you really need it, you can do data hiding in python. It just > >> requires a bit more work. > > >> --

GOZERBOT 0.8.1.0 released

2008-06-02 Thread Bart Thate
0.8.1.0 is here and can be downloaded from http://gozerbot.org new features: * ssl connections are now supported * third party software included into gozerbot: o feedparser (used by RSS) .. makes atom feeds possible o simplejson (used by COLLECTIVE) o Beautif

Re: Why does python not have a mechanism for data hiding?

2008-06-02 Thread Carl Banks
On Jun 2, 8:14 am, Carl Banks <[EMAIL PROTECTED]> wrote: > Fair enough, but I don't see anything in your example that suggests a > way to discriminate between access from within the class and access > from outside the class, which is the crucial aspect of data hiding. And, if you want an example

Re: Why does python not have a mechanism for data hiding?

2008-06-02 Thread Antoon Pardon
On 2008-06-02, Carl Banks <[EMAIL PROTECTED]> wrote: > On Jun 2, 6:40 am, Antoon Pardon <[EMAIL PROTECTED]> wrote: >> On 2008-06-02, Carl Banks <[EMAIL PROTECTED]> wrote: >> >> >> >> > On Jun 2, 5:38 am, Antoon Pardon <[EMAIL PROTECTED]> wrote: >> >> If you really need it, you can do data hiding in

Re: a question about the #prefix of sys.argv

2008-06-02 Thread Fossil Pan
On Jun 2, 8:50 am, Aldarion <[EMAIL PROTECTED]> wrote: > On 6月2日, 上午8时05分, Peter Otten <[EMAIL PROTECTED]> wrote: > > > Aldarion wrote: > > > for the little script > > > #egg.py > > > import sys > > > for k,v in enumerate(sys.argv): > > > print k,v > > > > it ignores the part after # on linux > >

Re: Why does python not have a mechanism for data hiding?

2008-06-02 Thread Carl Banks
On Jun 2, 9:07 am, Antoon Pardon <[EMAIL PROTECTED]> wrote: > On 2008-06-02, Carl Banks <[EMAIL PROTECTED]> wrote: > > > > > On Jun 2, 6:40 am, Antoon Pardon <[EMAIL PROTECTED]> wrote: > >> On 2008-06-02, Carl Banks <[EMAIL PROTECTED]> wrote: > > >> > On Jun 2, 5:38 am, Antoon Pardon <[EMAIL PROTEC

Re: Shed my a light :)

2008-06-02 Thread Paul Melis
TheSaint wrote: On 19:06, lunedì 02 giugno 2008 Chris wrote: actions= ('print', 'sum', 'divide', 'myfunction') parameters=(5, 'nothing',5.63, object) 8< 8< getattr(...) getattr(object, name[, default]) -> value 8< 8< for nn in actions: func = getattr(cp, nn) if callable(func)

Re: Why does python not have a mechanism for data hiding?

2008-06-02 Thread Antoon Pardon
On 2008-06-02, Carl Banks <[EMAIL PROTECTED]> wrote: > On Jun 2, 9:07 am, Antoon Pardon <[EMAIL PROTECTED]> wrote: >> On 2008-06-02, Carl Banks <[EMAIL PROTECTED]> wrote: >> >> >> >> > On Jun 2, 6:40 am, Antoon Pardon <[EMAIL PROTECTED]> wrote: >> >> On 2008-06-02, Carl Banks <[EMAIL PROTECTED]> wr

Re: mocking a logging object

2008-06-02 Thread Peter Bengtsson
On Jun 2, 12:34 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > Peter Bengtsson wrote: > > In my unittest I want to override the logger of a working module so > > that it puts all logging messages in /tmp/test.log instead so that in > > my unittest I can inspect that it logs things correctly. H

Re: parse dates

2008-06-02 Thread Eddie Corns
brechmos <[EMAIL PROTECTED]> writes: >Hi, >I have been using PHP the last while and in particular strtotime. >What I want to replicate is finding the second or fourth Monday of the >next month. In PHP with strtotime it is easy (strtotime("second >Monday", strtotime("next month"), but I can't fin

Re: ValueError: unknown locale: UTF-8

2008-06-02 Thread mr
On Jun 1, 8:43 pm, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > > ValueError: unknown locale: UTF-8 > > > This is on open bug or is there more to it? > > Do you have an environment variable set who is named > either LANG or starts with LC_? Actually, yes: LC_CTYPE=UTF-8 where is it coming from

Greetings, fellow Pythonistas!

2008-06-02 Thread The Pythonista
Hello, all! This post is to announce a new Python-oriented blog. See my .sig for the URL. I also have a question: is there any "official" method for getting listed on Planet Python? Thanks! A fellow Pythonista -- code.py: A blog about life, the universe, and Python http://pythonista.wordp

Re: Shed my a light :)

2008-06-02 Thread TheSaint
On 19:06, lunedì 02 giugno 2008 Chris wrote: >> actions= ('print', 'sum', 'divide', 'myfunction') >> parameters=(5, 'nothing',5.63, object) 8< 8< > getattr(...) > getattr(object, name[, default]) -> value 8< 8< > for nn in actions: > func = getattr(cp, nn) > if callable(func): >

Re: printf in python

2008-06-02 Thread gianluca
On 2 Giu, 10:08, Hrvoje Niksic <[EMAIL PROTECTED]> wrote: > gianluca <[EMAIL PROTECTED]> writes: > > Hy, I've a problem with may python library generated with swig from C > > code. I works and I can access all function but a simèple function > > that print a string don't work's. > > The function i

Re: ctypes, function pointers and a lot of trouble

2008-06-02 Thread Matt
Hi, okay, thanks now my DLL function seems to accept the functions given, but instead of running my program keeps crashing (with windows address violation errors). I did some further investigations on that and figured out that the contextH variable is not just an identifier as I thought, but

Re: php vs python

2008-06-02 Thread Lou Pecora
In article <[EMAIL PROTECTED]>, Ethan Furman <[EMAIL PROTECTED]> wrote: > Jerry Stuckle wrote: > > > > > As I've said before - good programmers can write good code in any > > language. > > > > So... an eloquent speaker of English is also an eloquent speaker of > Spanish/French/German? Oh,

Re: ThreadPoolingMixIn

2008-06-02 Thread pavel . uvarov
On May 31, 9:13 pm, Rhamphoryncus <[EMAIL PROTECTED]> wrote: > On May 30, 2:40 pm, [EMAIL PROTECTED] wrote: > > > Hi, everybody! > > > I wrote a useful class ThreadPoolingMixIn which can be used to create > > fast thread-based servers. This mix-in works much faster than > > ThreadingMixIn because i

Re: ThreadPoolingMixIn

2008-06-02 Thread pavel . uvarov
On Jun 2, 7:09 pm, [EMAIL PROTECTED] wrote: > On May 31, 9:13 pm, Rhamphoryncus <[EMAIL PROTECTED]> wrote: > > > On May 30, 2:40 pm, [EMAIL PROTECTED] wrote: > > > > Hi, everybody! > > > > I wrote a useful class ThreadPoolingMixIn which can be used to create > > > fast thread-based servers. This mi

Re: ThreadPoolingMixIn

2008-06-02 Thread Michael Ströder
[EMAIL PROTECTED] wrote: To benchmark this I used a simple tcp server which writes a small (16k) string to the client and closes the connection. Just a general note: When benchmarking such a network service it would be valuable to see benchmark results for several data sizes. I'd expect bette

Re: mocking a logging object

2008-06-02 Thread Peter Bengtsson
On Jun 2, 12:34 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > Peter Bengtsson wrote: > > In my unittest I want to override the logger of a working module so > > that it puts all logging messages in /tmp/test.log instead so that in > > my unittest I can inspect that it logs things correctly. H

Re: Shed my a light :)

2008-06-02 Thread TheSaint
On 22:00, lunedì 02 giugno 2008 Paul Melis wrote: > This doesn't exactly make sense, as what you want isn't really clear... Sorry, I'm bad to express my toughts even I my nature language :) I'll give a go to getattr() and see whether the results come in my taste :) -- Mailsweeper Home : http://i

Re: ThreadPoolingMixIn

2008-06-02 Thread pavel . uvarov
On Jun 2, 7:15 pm, Michael Ströder <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > To benchmark this I used a simple tcp server which writes a small > > (16k) > > string to the client and closes the connection. > > Just a general note: When benchmarking such a network service it would > b

[Re] Checking each item in m.group()?

2008-06-02 Thread [EMAIL PROTECTED]
Hello I need to go through each line of a CSV file, and extract some fields using a regex. Then, I need to check each retrieved field, and if it looks like "", turn this into NULL so that it's correct SQL. I tried a few things, but still can't it working: #Second field might be empty ->

python blogs

2008-06-02 Thread pythonblogs
Hello! It seems like Python blogs are gaining popularity. It seems to me that they play a crucial role in promoting Python as a language. Do you agree with that? Just a few days ago I've finished setting up a dedicated Python blogging environment at: http://www.pythonblogs.com Do you think it wil

Re: printf in python

2008-06-02 Thread gianluca
On 2 Giu, 17:54, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Mon, 2 Jun 2008 00:32:33 -0700 (PDT), gianluca <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > > Hy, I've a problem with may python library generated with swig from C > > code. I works and I can access all fun

Re: ValueError: unknown locale: UTF-8

2008-06-02 Thread Martin v. Löwis
> Actually, yes: > > LC_CTYPE=UTF-8 > > where is it coming from? This is basically on a clean new machine... > who might be setting it? There are many possible places. grep in your Library, as a starting point. As on Macintosh lists. > It is coming from a program elsewhere on the > system? How

Re: Checking each item in m.group()?

2008-06-02 Thread Matimus
On Jun 2, 11:42 am, "[EMAIL PROTECTED]" wrote: > Hello > > I need to go through each line of a CSV file, and extract some fields > using a regex. Then, I need to check each retrieved field, and if it > looks like "", turn this into NULL so that it's correct SQL. > > I tried a few things, but still

Re: Writing HTML

2008-06-02 Thread Stefan Behnel
Ken Starks wrote: > [EMAIL PROTECTED] wrote: >> I've searched the standard library docs, and, while there are a couple >> options for *reading* HTML from Python, I didn't notice any for >> *writing* it. Does anyone have any recommendations (particularly ones >> not listed on PyPI)? >> >> Thanks >

Re: ctypes, function pointers and a lot of trouble

2008-06-02 Thread Nick Craig-Wood
Matt <[EMAIL PROTECTED]> wrote: > class MemStreamData(Structure): > _fields_ = [("mode", c_byte), >("lPos", c_uint), >("dwVisibleSize", c_uint), >("dwBufferSize", c_uint), >("cpBuffer", POINTER(c_

robotparser behavior on 403 (Forbidden) robot.txt files

2008-06-02 Thread John Nagle
I just discovered that the "robotparser" module interprets a 403 ("Forbidden") status on a "robots.txt" file as meaning "all access disallowed". That's unexpected behavior. A major site ("http://www.aplus.net/robot.txt";) has their "robots.txt" file set up that way. There's no real "robots

Re: Formatting Output

2008-06-02 Thread Mensanator
On Jun 2, 3:38 am, Chris <[EMAIL PROTECTED]> wrote: > On Jun 2, 9:34 am, "[EMAIL PROTECTED]" > > <[EMAIL PROTECTED]> wrote: > > Hi, > > > i am building a little script and i want to output a series of columns > > more or less like this: > > > 1  5  6 > > 2  2  8 > > 2  9  5 > > > The matter is that

Re: Formatting Output

2008-06-02 Thread Doug Morse
On Mon, 2 Jun 2008 12:42:12 -0700 (PDT), Mensanator <[EMAIL PROTECTED]> wrote: > On Jun 2, 3:38 am, Chris <[EMAIL PROTECTED]> wrote: > > On Jun 2, 9:34 am, "[EMAIL PROTECTED]" > > > > <[EMAIL PROTECTED]> wrote: > > > Hi, > > > > > i am building a little script and i want to output a series of colu

Re: ANN: equivalence 0.1

2008-06-02 Thread Giuseppe Ottaviano
On Jun 1, 2008, at 6:16 PM, George Sakkis wrote: Equivalence is a class that can be used to maintain a partition of objects into equivalence sets, making sure that the equivalence properties (reflexivity, symmetry, transitivity) are preserved. Two objects x and y are considered equivalent eithe

Re: Python's doc problems: sort

2008-06-02 Thread Martin Marcher
Hi, On Wed, Apr 30, 2008 at 4:48 AM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > For example, in last week, that page is fetched 550 times. > The second most popular page, trails quite a distance. Here's the top yup that was me, i have access to a couple of machines and wanted to test some int

Re: platypus in page header

2008-06-02 Thread Mike Driscoll
On Jun 2, 1:16 pm, Laszlo Nagy <[EMAIL PROTECTED]> wrote: > Is it possible to use platypus in page header and footer? I need to > create a document with long paragraphs but also I need to put tables and > images in page header and multi line info in page footer with alignment etc. > > Thanks, > >  

Re: Why does python not have a mechanism for data hiding?

2008-06-02 Thread Russ P.
On Jun 2, 6:41 am, Carl Banks <[EMAIL PROTECTED]> wrote: > You are not realizing that only useful(**) thing about data hiding is > that some code has access to the data, other code does not. If you > "hide" data equally from everyone it's just a useless spelling change. I think you're missing th

Cast list of objects to list of strings

2008-06-02 Thread bukzor
I have this function: def write_err(obj): from sys import stderr stderr.write(str(obj)+"\n") and I'd like to rewrite it to take a variable number of objects. Something like this: def write_err(*objs): from sys import stderr stderr.write(" ".join(objs)+"\n") but I lose the pr

Re: Writing HTML

2008-06-02 Thread miller . paul . w
On Jun 2, 3:19 pm, Stefan Behnel <[EMAIL PROTECTED]> wrote: > Or lxml, for that purpose, which also is a lot nicer for generating XML and > HTML in the first place. > > http://codespeak.net/lxml/ Awesome. lxml looks like exactly what I'm after... and it's in the Ubuntu repos. :-) Thanks! -- htt

Re: robotparser behavior on 403 (Forbidden) robot.txt files

2008-06-02 Thread Martin v. Löwis
> I just discovered that the "robotparser" module interprets > a 403 ("Forbidden") status on a "robots.txt" file as meaning > "all access disallowed". That's unexpected behavior. That's specified in the "norobots RFC": http://www.robotstxt.org/norobots-rfc.txt - On server response indicating a

Re: Cast list of objects to list of strings

2008-06-02 Thread Larry Bates
bukzor wrote: I have this function: def write_err(obj): from sys import stderr stderr.write(str(obj)+"\n") and I'd like to rewrite it to take a variable number of objects. Something like this: def write_err(*objs): from sys import stderr stderr.write(" ".join(objs)+"\n") b

Re: [Re] Checking each item in m.group()?

2008-06-02 Thread Peter Otten
[EMAIL PROTECTED] wrote: > I need to go through each line of a CSV file, and extract some fields > using a regex. Then, I need to check each retrieved field, and if it > looks like "", turn this into NULL so that it's correct SQL. You are taking the wrong approach here. Don't build SQL statement

Re: python blogs

2008-06-02 Thread miller . paul . w
On Jun 2, 2:49 pm, [EMAIL PROTECTED] wrote: > It seems like Python blogs are gaining popularity. It seems to me that > they play a crucial role in promoting Python as a language. Neat! Do blogs on your site have to be about Python programming, or can people blog about anything? -- http://mail.py

Re: ThreadPoolingMixIn

2008-06-02 Thread miller . paul . w
On Jun 2, 12:41 pm, [EMAIL PROTECTED] wrote: > On Jun 2, 7:15 pm, Michael Ströder <[EMAIL PROTECTED]> wrote: > > Here are benchmarks for FreeBSD 6.2, amd64 > > packet_size         x         y >           0    499.57   1114.54 >        1024    499.29   1130.02 >        3072    500.09   1119.14 >  

Re: Checking each item in m.group()?

2008-06-02 Thread miller . paul . w
On Jun 2, 5:06 pm, Peter Otten <[EMAIL PROTECTED]> wrote: > You are taking the wrong approach here. > > Don't build SQL statements as strings; you are enabling the next SQL > injection attack. Pass parameters using the DB API instead. > > Don't use regular expressions to parse a CSV file. Python's

Re: python blogs

2008-06-02 Thread Mike Driscoll
On Jun 2, 4:14 pm, [EMAIL PROTECTED] wrote: > On Jun 2, 2:49 pm, [EMAIL PROTECTED] wrote: > > > It seems like Python blogs are gaining popularity. It seems to me that > > they play a crucial role in promoting Python as a language. > > Neat!  Do blogs on your site have to be about Python programming

Re: Formatting Output

2008-06-02 Thread Chris
On Jun 2, 9:43 pm, Doug Morse <[EMAIL PROTECTED]> wrote: > On Mon, 2 Jun 2008 12:42:12 -0700 (PDT), Mensanator <[EMAIL PROTECTED]> wrote: > >  On Jun 2, 3:38 am, Chris <[EMAIL PROTECTED]> wrote: > > > On Jun 2, 9:34 am, "[EMAIL PROTECTED]" > > > > <[EMAIL PROTECTED]> wrote: > > > > Hi, > > > > > i

Re: Formatting Output

2008-06-02 Thread Chris
On Jun 2, 11:34 pm, Chris <[EMAIL PROTECTED]> wrote: > On Jun 2, 9:43 pm, Doug Morse <[EMAIL PROTECTED]> wrote: > > > > > On Mon, 2 Jun 2008 12:42:12 -0700 (PDT), Mensanator <[EMAIL PROTECTED]> > > wrote: > > >  On Jun 2, 3:38 am, Chris <[EMAIL PROTECTED]> wrote: > > > > On Jun 2, 9:34 am, "[EMAIL

Re: php vs python

2008-06-02 Thread Patrick Mullen
Yeah I would agree that a decent (a few steps below good in my book) programmer should be able to have a decent handle on a new language, given some acclimatization time of course. The amount of time this period lasts varies on the language said programmer is learning, as well as the languages he

Re: Cast list of objects to list of strings

2008-06-02 Thread jay graves
On Jun 2, 4:02 pm, Larry Bates <[EMAIL PROTECTED]> wrote: > I think what you want is: > def write_err(*args): > from sys import stderr > stderr.write("\n".join([str(o) for o in args])) Slight nitpick. If you are using version >= 2.4 you could use a generator expression instead of a list

Re: Merging ordered lists

2008-06-02 Thread etal
On Jun 1, 1:49 am, Peter Otten <[EMAIL PROTECTED]> wrote: > Peter Otten wrote: > > #untested > > Already found two major blunders :( > > # still untested > import difflib > > def _merge(a, b): >     sm = difflib.SequenceMatcher(None, a, b) >     for op, a1, a2, b1, b2 in sm.get_opcodes(): >  

Re: Why does python not have a mechanism for data hiding?

2008-06-02 Thread Diez B. Roggisch
Well that's nice: you're accusing me of missing the point after having quoted something I wrote as if it represented by own views, even though I footnoted it and said I was only doing it for the sake of argument. Perhaps, outside this discussion, I am totally getting "the point". I can't tell,

Re: Formatting Output

2008-06-02 Thread Mensanator
On Jun 2, 2:43 pm, Doug Morse <[EMAIL PROTECTED]> wrote: > On Mon, 2 Jun 2008 12:42:12 -0700 (PDT), Mensanator <[EMAIL PROTECTED]> wrote: > >  On Jun 2, 3:38 am, Chris <[EMAIL PROTECTED]> wrote: > > > On Jun 2, 9:34 am, "[EMAIL PROTECTED]" > > > > <[EMAIL PROTECTED]> wrote: > > > > Hi, > > > > > i

Re: Database Query Contains Old Data

2008-06-02 Thread James A. Donald
On Wed, 21 May 2008 07:23:04 -0700 (PDT), Paul Boddie > MySQL appears to use "repeatable read" by default [1] as its > transaction isolation level, whereas PostgreSQL (for example) uses > "read committed" by default [2]. I would guess that if you were using > PostgreSQL, this particular problem wo

Importing xlrd

2008-06-02 Thread Chanman
This is probably a simple question to most of you, but here goes. I've downloaded the xlrd (version 0.6.1) module and placed in in the site-packages folder. Now, when I write a script, I type: import sys import xlrd When I run it, there is an import error saying there is no module named xlrd. H

Re: Cast list of objects to list of strings

2008-06-02 Thread Gary Herron
bukzor wrote: I have this function: def write_err(obj): from sys import stderr stderr.write(str(obj)+"\n") and I'd like to rewrite it to take a variable number of objects. Something like this: def write_err(*objs): from sys import stderr stderr.write(" ".join(objs)+"\n") b

Re: Better performance

2008-06-02 Thread David
On Mon, Jun 2, 2008 at 4:42 AM, Franck Y <[EMAIL PROTECTED]> wrote: > Hello Folks, > > I am facing a problem where i need to parse around 200 files, i have a > bit of knowledge in PHP/Perl/Python (the magic P :-P) > Trite answer: Use whatever is going to work best in your circumstances. All 3 lan

Re: Why does python not have a mechanism for data hiding?

2008-06-02 Thread Carl Banks
On Jun 2, 4:50 pm, "Russ P." <[EMAIL PROTECTED]> wrote: > On Jun 2, 6:41 am, Carl Banks <[EMAIL PROTECTED]> wrote: > > > You are not realizing that only useful(**) thing about data hiding is > > that some code has access to the data, other code does not. If you > > "hide" data equally from everyon

Re: Why does python not have a mechanism for data hiding?

2008-06-02 Thread Russ P.
On Jun 2, 3:04 pm, Carl Banks <[EMAIL PROTECTED]> wrote: > On Jun 2, 4:50 pm, "Russ P." <[EMAIL PROTECTED]> wrote: > > > On Jun 2, 6:41 am, Carl Banks <[EMAIL PROTECTED]> wrote: > > > > You are not realizing that only useful(**) thing about data hiding is > > > that some code has access to the data

Re: Merging ordered lists

2008-06-02 Thread etal
On Jun 1, 12:34 am, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > > I would do it two steps.  There's a number of ways to merge depending > on whether everything is pulled into memory or > not:http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/491285http://aspn.activestate.com/ASPN/Cookboo

Re: ANN: equivalence 0.1

2008-06-02 Thread George Sakkis
On Mon, Jun 2, 2008 at 6:31 AM, Giuseppe Ottaviano <[EMAIL PROTECTED]> wrote: > > On Jun 1, 2008, at 6:16 PM, George Sakkis wrote: > >> Equivalence is a class that can be used to maintain a partition of >> objects into equivalence sets, making sure that the equivalence >> properties (reflexivity, s

Re: Why does python not have a mechanism for data hiding?

2008-06-02 Thread Carl Banks
On Jun 2, 6:39 pm, "Russ P." <[EMAIL PROTECTED]> wrote: > On Jun 2, 3:04 pm, Carl Banks <[EMAIL PROTECTED]> wrote: > > > > > On Jun 2, 4:50 pm, "Russ P." <[EMAIL PROTECTED]> wrote: > > > > On Jun 2, 6:41 am, Carl Banks <[EMAIL PROTECTED]> wrote: > > > > > You are not realizing that only useful(**)

Re: Cast list of objects to list of strings

2008-06-02 Thread bukzor
On Jun 2, 2:56 pm, jay graves <[EMAIL PROTECTED]> wrote: > On Jun 2, 4:02 pm, Larry Bates <[EMAIL PROTECTED]> wrote: > > > I think what you want is: > > def write_err(*args): > > from sys import stderr > > stderr.write("\n".join([str(o) for o in args])) > > Slight nitpick. If you are usi

Re: Checking each item in m.group()?

2008-06-02 Thread rurpy
[EMAIL PROTECTED] wrote: > On Jun 2, 5:06 pm, Peter Otten <[EMAIL PROTECTED]> wrote: > >> You are taking the wrong approach here. >> >> Don't build SQL statements as strings; you are enabling the next SQL >> injection attack. Pass parameters using the DB API instead. >> >> Don't use regular express

Re: Code correctness, and testing strategies

2008-06-02 Thread Jacob Hallen
In article <[EMAIL PROTECTED]>, David <[EMAIL PROTECTED]> wrote: >> Clients generally require *working* software. Unfortunately it is all too >> easy to ship something broken because then you can claim you completed the >> coding on time and any slippage gets lost in the next 5 years of >> mainten

Re: Checking each item in m.group()?

2008-06-02 Thread Gilles Ganault
On Mon, 2 Jun 2008 12:06:21 -0700 (PDT), Matimus <[EMAIL PROTECTED]> wrote: >Here is a brief example. Note that this code is very insecure and >susceptible to a SQL injection attack. Hopefully these csv files are >from a trusted source. Yes they are, and this script will only run on my PC, so it d

Re: Why does python not have a mechanism for data hiding?

2008-06-02 Thread Russ P.
On Jun 2, 4:17 pm, Carl Banks <[EMAIL PROTECTED]> wrote: > On Jun 2, 6:39 pm, "Russ P." <[EMAIL PROTECTED]> wrote: > > > > > On Jun 2, 3:04 pm, Carl Banks <[EMAIL PROTECTED]> wrote: > > > > On Jun 2, 4:50 pm, "Russ P." <[EMAIL PROTECTED]> wrote: > > > > > On Jun 2, 6:41 am, Carl Banks <[EMAIL PROTE

Ideas for master's thesis

2008-06-02 Thread Filip Gruszczyński
Hello there, I am student of CS at the University of Warsaw, currently 4th year. I am attending Object Oriented Programming seminar and it is about time, I started looking for an idea of my master's degree project. As I like Python very much, I would like to do something with this language, yet I

Re: Why does python not have a mechanism for data hiding?

2008-06-02 Thread Paul Rubin
"Russ P." <[EMAIL PROTECTED]> writes: > I also realize, by the way, that Python allows a client of a class to > define a new class member from completely outside the class > definition. Obviously, that cannot be declared private. This is bogus about 95% of the time though. For the cases where it

Re: Why does python not have a mechanism for data hiding?

2008-06-02 Thread Carl Banks
On Jun 2, 7:41 pm, "Russ P." <[EMAIL PROTECTED]> wrote: > I thought you were saying that encapsulation or so-called "data > hiding" is worthless. If I misunderstood you, then I apologize. I > don't have time to go back and sort it all out. No, not at all. I was suggesting that Antoon's example of

Re: Importing xlrd

2008-06-02 Thread Gary Herron
Chanman wrote: This is probably a simple question to most of you, but here goes. I've downloaded the xlrd (version 0.6.1) module and placed in in the site-packages folder. Now, when I write a script, I type: import sys import xlrd When I run it, there is an import error saying there is no modu

Re: Why does python not have a mechanism for data hiding?

2008-06-02 Thread Carl Banks
On Jun 2, 10:14 am, Antoon Pardon <[EMAIL PROTECTED]> wrote: > On 2008-06-02, Carl Banks <[EMAIL PROTECTED]> wrote: > > > > > On Jun 2, 9:07 am, Antoon Pardon <[EMAIL PROTECTED]> wrote: > >> On 2008-06-02, Carl Banks <[EMAIL PROTECTED]> wrote: > > >> > On Jun 2, 6:40 am, Antoon Pardon <[EMAIL PROTE

  1   2   >