Re: What Python looks like

2008-08-05 Thread Santiago Romero
> I'm curious, what did Python code look like to those of you who have > seen a bunch of Python code for the first time before k Clean and readable. -- http://mail.python.org/mailman/listinfo/python-list

Re: overriding file.readline: "an integer is required"

2008-08-05 Thread Gabriel Genellina
En Fri, 01 Aug 2008 16:21:26 -0300, kj <[EMAIL PROTECTED]> escribi�: In <[EMAIL PROTECTED]> Miles <[EMAIL PROTECTED]> writes: On Wed, Jul 30, 2008 at 5:52 PM, kj <[EMAIL PROTECTED]> wrote: I know that I could rewrite the method like this: def readline(self, size=None): if size ==

Re: very large dictionary

2008-08-05 Thread Simon Strobl
> Have you considered that the operating system imposes per-process limits > on memory usage? You say that your server has 128 GB of memory, but that > doesn't mean the OS will make anything like that available. According to our system administrator, I can use all of the 128G. > > I thought it wo

Re: UnicodeDecodeError, how to elegantly deal with this?

2008-08-05 Thread Jorgen Bodde
Hi Edwin, Filemask is obvious as it is assigned in the python code itself. It is "%file%". The idea is that the file clicked is substituted for the "%file%" by the replace action. The file that needs to be substituted is a simple file on disk. Here is a dump of the file and it's characters. I do

Any tips on Python web development on Mac OS

2008-08-05 Thread Tim Greening-Jackson
Hi there. I've recently learned Python -- but would by no means describe myself as expert -- and have a couple of "pet" projects I want to do in my spare time in order to consolidate what I've learned by using it to solve "real" problems. I'd like to create a couple of websites on my Mac at

Re: Hobbyist - Python vs. other languages

2008-08-05 Thread Tim Greening-Jackson
Tobiah wrote: You may enjoy: http://www.pythonchallenge.com/ It's a blast and a half. To solve the puzzles you have to write python programs that do various things. Thanks for that. I can see that will keep me amused for quote some time. -- http://mail.python.org/mailman/listinfo/python-li

Re: UnicodeDecodeError, how to elegantly deal with this?

2008-08-05 Thread Jorgen Bodde
Hi John, > If you don't want to be bothered with "unicode problems": > (1) Don't create a "unicode problem" when one doesn't exist. > (2) Don't bother other people with *your* "unicode problems". Well I guess you misunderstood what I meant. I meant I am a simple developer, getting a string from t

Re: UnicodeDecodeError, how to elegantly deal with this?

2008-08-05 Thread John Machin
On Aug 5, 4:23 am, "Jorgen Bodde" <[EMAIL PROTECTED]> wrote: > Hi All, > > I am relatively new to python unicode pains and I would like to have > some advice. I have this snippet of code: > thefile = args["file"] > filemask = u"%file%" > therep = arg.replace(filemask, thefi

regex question

2008-08-05 Thread Fred Mangusta
Hi, I would like to delete all the instances of a '.' into a number. In other words I'd like to replace all the instances of a '.' character with something (say nothing at all) when the '.' is representing a decimal separator. E.g. 500.675 > 500675 but also 1.000.456.344 > 1

Re: What Python looks like

2008-08-05 Thread Gabriel Genellina
En Mon, 04 Aug 2008 19:20:18 -0300, Ben Finney <[EMAIL PROTECTED]> escribi�: iu2 <[EMAIL PROTECTED]> writes: I'm curious, what did Python code look like to those of you who have seen a bunch of Python code for the first time before knowing Python? To me it looked like the pseudo-code used

Re: How to concatenate datetime.date object and datetime.time object

2008-08-05 Thread Steven D'Aprano
On Tue, 05 Aug 2008 02:25:34 -0700, Will Rocisky wrote: > Actually I am trying to save both date and time in one cell but they are > given separately by user. What's a "cell"? I suggest building a datetime.datetime() object: >>> date = datetime.date(2008, 8, 5) >>> time = datetime.time(19, 54)

Re: URLs and ampersands

2008-08-05 Thread Wojtek Walczak
Dnia 05 Aug 2008 09:59:20 GMT, Steven D'Aprano napisa�(a): > I didn't say it urlretrieve was escaping the URL. I actually think the > URLs are pre-escaped when I scrape them from a HTML file. I have searched > for, but been unable to find, standard library functions that escapes or > unescapes

Re: Wrapping C with Python

2008-08-05 Thread Uwe Schmitt
On 4 Aug., 15:14, brad <[EMAIL PROTECTED]> wrote: > RPM1 wrote: > > ... > > > Basically you just compile your C code as a regular C code dll.  ctypes > > then allows you to access the functions in the dll very easily. > > Does that work with C++ code too or just C? It works if the interface of the

Re: Python-URL! - weekly Python news and links (Jul 28)

2008-08-05 Thread Bruno Desthuilliers
Gabriel Genellina a écrit : QOTW: "Python's goals are to maximize opportunities for good programming, which is quite different." - Bruno Desthuilliers, contrasting Python with Java I'm afraid I mostly (and approximatly) quoted somebody else here (just don't ask me for a link to the original.

Re: very large dictionary

2008-08-05 Thread Steven D'Aprano
On Tue, 05 Aug 2008 01:20:08 -0700, Simon Strobl wrote: >> > I thought it would be practical not to create the dictionary from a >> > text file each time I needed it. I.e. I thought loading the .pyc-file >> > should be faster. Yet, Python failed to create a .pyc-file >> >> Probably a good example

Re: regex question

2008-08-05 Thread Marc 'BlackJack' Rintsch
On Tue, 05 Aug 2008 11:39:36 +0100, Fred Mangusta wrote: > In other words I'd like to replace all the instances of a '.' character > with something (say nothing at all) when the '.' is representing a > decimal separator. E.g. > > 500.675 > 500675 > > but also > > 1.000.456.344 >

Re: very large dictionary

2008-08-05 Thread Enrico Franchi
Simon Strobl <[EMAIL PROTECTED]> wrote: > Well, as I was using Python, I did not expect to have to care about > the language's internal affairs that much. I thought I could simply do > always the same no matter how large my files get. In other words, I > thought Python was really scalable. It's n

Re: Hobbyist - Python vs. other languages

2008-08-05 Thread Enrico Franchi
<[EMAIL PROTECTED]> wrote: > A programming language is a tool to solve problems, so first of all: > do you have problems to solve? You can create some visualizations, > some program with GUI, some networked code to download things and > process them, etc. It's surprising how hard is this part. I

Re: UnicodeDecodeError, how to elegantly deal with this?

2008-08-05 Thread John Machin
On Aug 5, 8:37 pm, "Jorgen Bodde" <[EMAIL PROTECTED]> wrote: > Hi John, > > > If you don't want to be bothered with "unicode problems": > > (1) Don't create a "unicode problem" when one doesn't exist. > > (2) Don't bother other people with *your* "unicode problems". > > Well I guess you misundersto

Re: very large dictionary

2008-08-05 Thread Gabriel Genellina
En Mon, 04 Aug 2008 11:02:16 -0300, Simon Strobl <[EMAIL PROTECTED]> escribió: I created a python file that contained the dictionary. The size of this file was 6.8GB. I thought it would be practical not to create the dictionary from a text file each time I needed it. I.e. I thought loading the

Re: URLs and ampersands

2008-08-05 Thread Steven D'Aprano
On Mon, 04 Aug 2008 23:16:46 -0300, Gabriel Genellina wrote: > En Mon, 04 Aug 2008 20:43:45 -0300, Steven D'Aprano > <[EMAIL PROTECTED]> escribi�: > >> I'm using urllib.urlretrieve() to download HTML pages, and I've hit a >> snag with URLs containing ampersands: >> >> http://www.example.com/parro

How to concatenate datetime.date object and datetime.time object

2008-08-05 Thread Will Rocisky
Actually I am trying to save both date and time in one cell but they are given separately by user. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to concatenate datetime.date object and datetime.time object

2008-08-05 Thread Thomas Wright
Will Rocisky wrote: > Actually I am trying to save both date and time in one cell but they > are given separately by user. http://docs.python.org/lib/datetime-datetime.html indicates that the function you're looking for is datetime.datetime.combine(d, t). HTH! -- I'm at CAMbridge, not SPAMbridg

Re: Keg - A python web framework

2008-08-05 Thread Ken Starks
Daniel Fetchinson wrote: I've been working on a python web framework which I think might be of interest to you. Details may be found at http://code.google.com/p/keg/wiki/Concept. All suggestions or comments will be greatly appreciated. I fail to see what the advantages of your framework are o

Re: URLs and ampersands

2008-08-05 Thread Richard Brodie
"Steven D'Aprano" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I could just do a string replace, but is there a "right" way to escape > and unescape URLs? The right way is to parse your HTML with an HTML parser. URLs are not exempt from the normal HTML escaping rules, although

Re: Hobbyist - Python vs. other languages

2008-08-05 Thread Michele Simionato
On Jul 31, 8:32 pm, fprintf <[EMAIL PROTECTED]> wrote: > Since I don't have a specific problem to solve, besides > Pythonchallenge (which I found very cryptic), and Project Euler (which > I found beyond my mathematics skills), is there a place to go for > increasingly difficult problems to solve? I

robust optimisation

2008-08-05 Thread sh . mojtahedzadeh
Dear all, I have a LP model here as follow: Min = .42*x1 + .56*x2 + .70*x3; S.t. x1 + x2 + x3 = 900; x1 <= 400 * y1; x2 <= 700 * y2; x3 <= 600 * y3; 30*x1 <= 12500; 40*x2 <= 2; 50*x3 <=15000; .15*x1 + .2*x2 +.15*x3 >= 100; .2*x1 + .05*x2 + .2*x3 >= 100; .25*x1 + .15*x2+ .05*x3 >= 150;

Re: regex question

2008-08-05 Thread Alexei Zankevich
No, there is a bad way - because of the example doesn't solve arbitrary amount of ... blocks. But the python regexp engine supports for lookahead (?=pattern) and lookbehind (?<=pattern). In those cases patterns are not included into the replaced sequence of characters: >>> re.sub('(?<=\d)\.(?=\d)',

Re: URLs and ampersands

2008-08-05 Thread Duncan Booth
Steven D'Aprano <[EMAIL PROTECTED]> wrote: > I didn't say it urlretrieve was escaping the URL. I actually think the > URLs are pre-escaped when I scrape them from a HTML file. I have > searched for, but been unable to find, standard library functions that > escapes or unescapes URLs. Are there any

Re: Why doesn't import work?

2008-08-05 Thread Alan Franzoni
ssecorp was kind enough to say: > I have in Lib/site-packages a module named pdfminer. when I do import > pdfminer it complains: > import pdfminer If you've got a directory, that's not a module - it's a package. In order to import a directory as a package, you must create a (possibly empty

Re: Garbage collection of recursive inner function

2008-08-05 Thread from . future . import
On Aug 5, 5:23 am, Terry Reedy <[EMAIL PROTECTED]> wrote: > To understand this, it helps to realize that Python functions are not, > in themselves, recursive. Recursiveness at any time is a property of a > function in an environment, which latter can change. More specifically, > a function call

Re: regex question

2008-08-05 Thread Jeff
On Aug 5, 7:10 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Tue, 05 Aug 2008 11:39:36 +0100, Fred Mangusta wrote: > > In other words I'd like to replace all the instances of a '.' character > > with something (say nothing at all) when the '.' is representing a > > decimal separator.

Re: Any tips on Python web development on Mac OS

2008-08-05 Thread Jeff
On Aug 5, 4:41 am, Tim Greening-Jackson wrote: > Hi there. > > I've recently learned Python -- but would by no means describe myself as > expert -- and have a couple of "pet" projects I want to do in my spare > time in order to consolidate what I've learned by using it to solve > "real" problems.

Re: Python packages on the Mac

2008-08-05 Thread Jeff
On Aug 4, 11:20 pm, [EMAIL PROTECTED] wrote: > Hi, > > I would like to copy the contents of the PythonFramework.pkg folder > and run python without having to run the installer on the Mac. On > windows it's simple to copy the contents of the python folder and the > python dll's. How can this be done

Re: Using two pythons in an application

2008-08-05 Thread Jorgen Grahn
On Sun, 03 Aug 2008 17:36:40 -0500, Larry Bates <[EMAIL PROTECTED]> wrote: > Allen wrote: >> I'm in the process of developing an application that will use Python for >> a scripting support. In light of the upcoming changes to Python, I was >> wondering if it is possible to link to and use two di

Re: Any tips on Python web development on Mac OS

2008-08-05 Thread Bruno Desthuilliers
Tim Greening-Jackson a écrit : (snip) I'd like to create a couple of websites on my Mac at home. I have a very basic understanding of HTML, but am lazy and would prefer to do the work either in Python itself or have some package I can use in conjunction with Python. You're not going to get an

Getting mod_python to Work

2008-08-05 Thread jpuopolo
Hi, all... I am hoping that someone can help me with the magic incantation to get mod_python working on my local machine. Set up: Apache 2.2.9, mod_python 3.3.1 on Windows Vista (yes, pity me). I've gotten the basic mptest.py handler to work with no problem. I am now trying to use the mod_python

ANN: eGenix mx Base Distribution 3.1.1

2008-08-05 Thread eGenix Team: M.-A. Lemburg
ANNOUNCING eGenix.com mx Base Distribution Version 3.1.1 Open Source Python extensions providing important and useful services for Python programmers

Re: regex question

2008-08-05 Thread Alexei Zankevich
=) Indeed. But it will replace all dots including ordinary strings instead of numbers only. On Tue, Aug 5, 2008 at 3:23 PM, Jeff <[EMAIL PROTECTED]> wrote: > On Aug 5, 7:10 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > > On Tue, 05 Aug 2008 11:39:36 +0100, Fred Mangusta wrote: > > > I

More Datastore Examples Please

2008-08-05 Thread v4vijayakumar
Google appengine datastore is not very clear, and I couldn't get much from API documents. It would be very helpful if there are some more detailed documents with examples. Django provides very good documentation, but I don't know how much it is compatible with google appengine. Google appengine ex

Re: regex question

2008-08-05 Thread Chris
On Aug 5, 2:23 pm, Jeff <[EMAIL PROTECTED]> wrote: > On Aug 5, 7:10 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > > > > > On Tue, 05 Aug 2008 11:39:36 +0100, Fred Mangusta wrote: > > > In other words I'd like to replace all the instances of a '.' character > > > with something (say noth

Re: What Python looks like

2008-08-05 Thread brad
Gary Herron wrote: My impression was (and still is): A page of Python code looks *clean*, with not a lot of punctuation/special symbols and (in particular) no useless lines containing {/} or begin/end or do/done (or whatever). what about all those 'self' thingys? :) -- http://mail.python.o

Re: Python packages on the Mac

2008-08-05 Thread Kevin Walzer
[EMAIL PROTECTED] wrote: Hi, I would like to copy the contents of the PythonFramework.pkg folder and run python without having to run the installer on the Mac. On windows it's simple to copy the contents of the python folder and the python dll's. How can this be done on the Mac? Thanks Sunil

Re: What Python looks like

2008-08-05 Thread rynt
On Aug 4, 12:06 pm, iu2 <[EMAIL PROTECTED]> wrote: > Hi, > > This is a little bit strange post, but I'm curious... > > I learned Python from its tutorial step by step, and practicing > writing small scripts. > I haven't seen a Python program before knowing Python. > > I'm curious, what did Python c

Redirecting stderr and stdout to syslog

2008-08-05 Thread Lincoln Yeoh
Hi, I've just started to learn python (I've been using perl for some years). How do I redirect ALL stderr stuff to syslog, even stderr from external programs that don't explicitly change their own stderr? Say I have a program called foo: #!/usr/bin/python import syslog import os, sys class l

Re: Are makepy-generated COM wrapper classes distributable?

2008-08-05 Thread gundlach
On Aug 4, 2:24 am, gundlach <[EMAIL PROTECTED]> wrote: > Can I somehow bundle the generated modules into my > setuptools package so that the wrappers are installed at the same > time?  (If so, how -- just copy them into the package directory?)  Or > are the wrappers targeted to my machine or instal

Python-URL! - weekly Python news and links (Aug 5)

2008-08-05 Thread Gabriel Genellina
QOTW: "As a project manager, I have never had trouble finding people with crazy ideas. I have trouble finding people who can execute. IOW, 'innovation' is way oversold. And it sure as hell shouldn't be applied to products like MS Word or Open office." - Linus http://www.simple-talk.com/opin

Re: Python FTP - NameError: name 'mydpa' is not defined

2008-08-05 Thread Ej
I have a similar problem. I need to download the same file every hour so it will be nice to be able to rename the downloads with a variable name. For example in this case: from ftplib import FTP ftp=FTP('tgftp.nws.noaa.gov') ftp.login() ftp.cwd('SL.us008001/DF.of/DC.radar/DS.81dpr/SI.kbuf') ftp.

How to do CPU/Memory benchmarking in Python?

2008-08-05 Thread Omer Khalid
Hi, I have few long running python based scripts which does lots of number crunching; I would like to bench mark the CPU/Memory/IO for that script. I am wondering if there is a python benchmarking suite available? There is pybench but it more or less test the executing script it self from Python's

Re: interpreter vs. compiled

2008-08-05 Thread [EMAIL PROTECTED]
On Aug 3, 1:26 am, castironpi <[EMAIL PROTECTED]> wrote: > On Aug 2, 2:02 pm, Tim Roberts <[EMAIL PROTECTED]> wrote: > > > castironpi <[EMAIL PROTECTED]> wrote: > > > >And furthermore, I think I'm getting > > >confused about what exactly constitutes an interpreter: it is whether > > >there is a pro

Re: Getting mod_python to Work

2008-08-05 Thread jpuopolo
On Aug 5, 8:44 am, jpuopolo <[EMAIL PROTECTED]> wrote: > Hi, all... > > I am hoping that someone can help me with the magic incantation to get > mod_python working on my local machine. > > Set up: Apache 2.2.9, mod_python 3.3.1 on Windows Vista (yes, pity > me). > > I've gotten the basic mptest.py

Re: Python FTP - NameError: name 'mydpa' is not defined

2008-08-05 Thread Fredrik Lundh
Ej wrote: I have a similar problem. I need to download the same file every hour so it will be nice to be able to rename the downloads with a variable name. For example in this case: from ftplib import FTP ftp=FTP('tgftp.nws.noaa.gov') ftp.login() ftp.cwd('SL.us008001/DF.of/DC.radar/DS.81dpr/SI.

Re: What Python looks like

2008-08-05 Thread Tyler Breisacher
To paraphrase this video (http://www.youtube.com/watch?v=zJOS0sV2a24) (which is the Randall Munroe, author of the famous xkcd (http://www.xkcd.com/), giving a talk at Google), "you just type the pseudo-code and it runs! And as someone said, if Python is executable pseudo-code, then Perl is exec

Re: Decimals not equalling themselves (e.g. 0.2 = 0.2000000001)

2008-08-05 Thread schinckel
On Aug 5, 3:26 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Sun, 03 Aug 2008 19:57:10 -0300, Grant Edwards <[EMAIL PROTECTED]>   > escribi : > > > On 2008-08-03, Larry Bates <[EMAIL PROTECTED]> wrote: > > >> What are they teaching in computer science classes these days? > > > When I was

Re: regex question

2008-08-05 Thread Fred Mangusta
Chris wrote: Doesn't work for his use case as he wants to keep periods marking the end of a sentence. Exactly. Thanks to all of you anyway, now I have a better understanding on how to go on :) F. -- http://mail.python.org/mailman/listinfo/python-list

Strange return behavior for function

2008-08-05 Thread Robert Dailey
Hi, I've created a function to normalize Subversion URLs, however when I return a string, printing the result of the function becomes "None". When I print the value of the string before I return from the function, I see a valid string. What's going on? The function is below: def normurl( url_roo

Re: Strange return behavior for function

2008-08-05 Thread Robert Dailey
On Tue, Aug 5, 2008 at 10:05 AM, Robert Dailey <[EMAIL PROTECTED]> wrote: > Hi, > > I've created a function to normalize Subversion URLs, however when I return > a string, printing the result of the function becomes "None". When I print > the value of the string before I return from the function,

Brainwave: A Complete Web Platform With Database Out of the Box

2008-08-05 Thread Michael Mabin
What do you all think of this? Brainwave is a complete Web Development Platform with a DDL-free database. Its application server is built on CherryPy. It comes already bundled with Cheetah and Mako templating engines. And its database is its true gem. The database is built on a "neural" model.

Re: What Python looks like

2008-08-05 Thread Brett Ritter
On Aug 4, 3:43 pm, Gary Herron <[EMAIL PROTECTED]> wrote: > A page of Python code looks *clean*,  with not a lot of > punctuation/special symbols and (in particular) no useless lines I am actually going to buck the trend. My first impression of Python was that it was visually hard to parse. When

Re: Any tips on Python web development on Mac OS

2008-08-05 Thread Tim Greening-Jackson
Bruno Desthuilliers wrote: Tim Greening-Jackson a écrit : (snip) You're not going to get anywhere without learning (x)html and css IMHO. Even using a "graphical" html editor like Dreamweaver requires having a good enough (IOW : being able to do it all by hand) knowledge of these languages. W

Link Checking Issues - Sub domains

2008-08-05 Thread rpupkin77
Hi, I have written this script to run as a cron that will loop through a text file with a list of urls. It works fine for most of the links, however there are a number of urls which are subdomains (they are government sites) such as http://basename.airforce.mil, these links are always throwing 400

Re: PIL (etc etc etc) on OS X

2008-08-05 Thread David C. Ullrich
In article <[EMAIL PROTECTED]>, Kevin Walzer <[EMAIL PROTECTED]> wrote: > David C. Ullrich wrote: > > Just as well that the message sent earlier today > > seems to have been lost... > > > > Ok. Read your instructions on libjpeg. Read some > > of the install.doc. ./configure, fine. make, fine. >

Re: Brainwave: A Complete Web Platform With Database Out of the Box

2008-08-05 Thread Avinash Vora
On Aug 5, 2008, at 8:37 PM, Michael Mabin wrote: Brainwave is a complete Web Development Platform with a DDL-free database. Its application server is built on CherryPy. It comes already bundled with Cheetah and Mako templating engines. And its database is its true gem. You aren't differ

Re: Python FTP - NameError: name 'mydpa' is not defined

2008-08-05 Thread Ej
Hi Fredrik, Thanks so much for you quick help!!! I googled the os.rename you gave me and I found solution to solve my problem. You made my day! On Aug 5, 10:37 am, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Ej wrote: > > I have a similar problem. I need to download the same file every hour >

Re: PIL (etc etc etc) on OS X

2008-08-05 Thread David C. Ullrich
In article <[EMAIL PROTECTED]>, Irmen de Jong <[EMAIL PROTECTED]> wrote: > David C. Ullrich wrote: > > Just as well that the message sent earlier today > > seems to have been lost... > > > > Ok. Read your instructions on libjpeg. Read some > > of the install.doc. ./configure, fine. make, fine. >

Re: PIL (etc etc etc) on OS X

2008-08-05 Thread David C. Ullrich
In article <[EMAIL PROTECTED]>, "David C. Ullrich" <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > Irmen de Jong <[EMAIL PROTECTED]> wrote: > > > David C. Ullrich wrote: > > > Decided to try to install PIL on my Mac (OS X.5). > > > > > > I know nothing about installing programs

Re: proposal, change self. to .

2008-08-05 Thread David C. Ullrich
In article <[EMAIL PROTECTED]>, Nick Dumas <[EMAIL PROTECTED]> wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > It's also worth noting that you can use a different name for the object > that represents your class. If you did def __init__(foo):pass, then you > would be able to access

Print statement isn't showing up?

2008-08-05 Thread Robert Dailey
Hi, I have the following code: def ReplaceExternalWithCopy( localDir, remoteDir ): print "Removing external local directory:", localDir rmdirs( localDir ) vfxrepo.copy( remoteDir, localDir ) I noticed that the print statement above does not show up before vfxrepo.copy() is called. t

Re: Questions about asyncore

2008-08-05 Thread Josiah Carlson
On Jul 29, 4:09 am, Frank Millman <[EMAIL PROTECTED]> wrote: > Hi all > > I have been using my own home-brewed client/server technique for a > while, using socket and select. It seems to work ok. The server can > handle multiple clients. It does this by creating a new thread for > each connection.

Is there a faster way to do this?

2008-08-05 Thread [EMAIL PROTECTED]
I have a csv file containing product information that is 700+ MB in size. I'm trying to go through and pull out unique product ID's only as there are a lot of multiples. My problem is that I am appending the ProductID to an array and then searching through that array each time to see if I've seen t

Re: Is there a faster way to do this?

2008-08-05 Thread Gary Herron
[EMAIL PROTECTED] wrote: I have a csv file containing product information that is 700+ MB in size. I'm trying to go through and pull out unique product ID's only as there are a lot of multiples. My problem is that I am appending the ProductID to an array and then searching through that array each

Re: Doubts about how implementing asynchronous timeouts through a heap

2008-08-05 Thread Josiah Carlson
On Jul 12, 12:16 pm, Josiah Carlson <[EMAIL PROTECTED]> wrote: > On Jul 9, 4:13 am, "Giampaolo Rodola'" <[EMAIL PROTECTED]> wrote: > > > > > Hi, > > I'm trying to implement an asynchronous scheduler forasyncoreto call > > functions at a later time without blocking the main loop. > > The logic behin

Re: Is there a faster way to do this?

2008-08-05 Thread Avinash Vora
On Aug 5, 2008, at 10:00 PM, [EMAIL PROTECTED] wrote: I have a csv file containing product information that is 700+ MB in size. I'm trying to go through and pull out unique product ID's only as there are a lot of multiples. My problem is that I am appending the ProductID to an array and then sea

Re: Is there a faster way to do this?

2008-08-05 Thread Gary Herron
Avinash Vora wrote: On Aug 5, 2008, at 10:00 PM, [EMAIL PROTECTED] wrote: I have a csv file containing product information that is 700+ MB in size. I'm trying to go through and pull out unique product ID's only as there are a lot of multiples. My problem is that I am appending the ProductID to

Re: URLs and ampersands

2008-08-05 Thread Gabriel Genellina
En Tue, 05 Aug 2008 06:59:20 -0300, Steven D'Aprano <[EMAIL PROTECTED]> escribió: > On Mon, 04 Aug 2008 23:16:46 -0300, Gabriel Genellina wrote: > >> En Mon, 04 Aug 2008 20:43:45 -0300, Steven D'Aprano >> <[EMAIL PROTECTED]> escribi�: >> >>> I'm using urllib.urlretrieve() to download HTML pages,

Password prompt with mask

2008-08-05 Thread Robert Dailey
Hi, I'm looking for something simple that I can use to obtain passwords from the user. Something like input(), but with an option to set the mask character. So if I set it to "*", then all the user will see is: ** as they type their password. I know about getpass.getpass(), but I want somethin

Re: interpreter vs. compiled

2008-08-05 Thread castironpi
On Aug 5, 9:21 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On Aug 3, 1:26 am, castironpi <[EMAIL PROTECTED]> wrote: > > > > Which is 12 bytes long and runs in a millisecond.  What it does is set > > a memory address to successive integers 0..9, then yields.  Due to the > > nature of progra

Re: URLs and ampersands

2008-08-05 Thread Matthew Woodcraft
Steven D'Aprano wrote: > I'm using urllib.urlretrieve() to download HTML pages, and I've hit a > snag with URLs containing ampersands: > > http://www.example.com/parrot.php?x=1&y=2 > > Somewhere in the process, urls like the above are escaped to: > > http://www.example.com/parrot.php?x=1&y=2 > > w

Re: proposal, change self. to .

2008-08-05 Thread bearophileHUGS
Heiko Wundram: > > how about changing the precious self. to . > > imagine > > self.update() > > .update() > > simple right? I suggest you to start using Ruby instead. Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

Re: Decimals not equalling themselves (e.g. 0.2 = 0.2000000001)

2008-08-05 Thread Gabriel Genellina
En Tue, 05 Aug 2008 11:50:43 -0300, schinckel <[EMAIL PROTECTED]> escribió: > I had a class today which dealt with Decimal <-> IEE754 conversion, > and > whilst 0.1 was an example that was converted, and a representation was > generated, no mention was made of the precision issue. > > I'm hoping t

How to troubleshoot hanging script?

2008-08-05 Thread kj
Hi! I have a Pythonoob question. I have a script that hangs indefinitely at random times; the only thing to do at this point is to kill it. I'm looking for suggestions on how to troubleshoot and debug the problem. I'm not even sure of where exactly the script is hanging, though I suspect it i

Re: Python-URL! - weekly Python news and links (Jul 28)

2008-08-05 Thread Gabriel Genellina
En Tue, 05 Aug 2008 06:28:33 -0300, Bruno Desthuilliers <[EMAIL PROTECTED]> escribió: > Gabriel Genellina a écrit : >> QOTW: "Python's goals are to maximize opportunities for good >> programming, which is quite different." - Bruno Desthuilliers, contrasting >> Python with Java >> > > I'm afraid

Re: URLs and ampersands

2008-08-05 Thread Matthew Woodcraft
Gabriel Genellina wrote: > Steven D'Aprano wrote: >> I have searched for, but been unable to find, standard library >> functions that escapes or unescapes URLs. Are there any such >> functions? > Yes: cgi.escape/unescape, and xml.sax.saxutils.escape/unescape. I don't see a cgi.unescape in the st

regex search loops instead of findall

2008-08-05 Thread brad
Hi guys... I'm trying to make my Python regex code behave like my C++ regex code. In order to search large strings for *all* occurrences of the thing I'm searching for, I loop like this in C++: void number_search(const std::string& portion, const boost::regex& Numbers) { boost::smatch m

Re: Class definition attribute order

2008-08-05 Thread Terry Reedy
Michele Simionato wrote: BTW, since I do not really follow python-dev, do you know if some consensus was reached on the issue of adding an ordered dict implementation to the standard library? I thought there was to be one added to collections, where default_dict lives, but I do not remember

Re: regex search loops instead of findall

2008-08-05 Thread Waldemar Osuch
On Aug 5, 12:06 pm, brad <[EMAIL PROTECTED]> wrote: > Hi guys... I'm trying to make my Python regex code behave like my C++ > regex code. In order to search large strings for *all* occurrences of > the thing I'm searching for, I loop like this in C++: > > void number_search(const std::string& porti

Re: proposal, change self. to .

2008-08-05 Thread Russ P.
On Aug 3, 4:10 am, "Heiko Wundram" <[EMAIL PROTECTED]> wrote: > Am 03.08.2008, 12:51 Uhr, schrieb Equand <[EMAIL PROTECTED]>: > > > how about changing the precious self. to . > > imagine > > > self.update() > > > .update() > > > simple right? > > What about: > > class x: > > def x(self,ob): >

Re: Decimals not equalling themselves (e.g. 0.2 = 0.2000000001)

2008-08-05 Thread Dave
On 3 Aug, 15:02, CNiall <[EMAIL PROTECTED]> wrote: > However, with some, but not all, decimals, they do not seem to 'equal > themselves'. Back in my days studying electrical engineering I was pointed to this reference about floating point arithmetic - http://citeseer.ist.psu.edu/goldberg91what.ht

Psycho question

2008-08-05 Thread David C. Ullrich
Just heard about Psycho. I've often wondered why someone doesn't make something that does exactly what Psycho does - keen. Silly question: It's correct, is it not, that Psycho doesn't actually modify the Python installation, except by adding a module or two (so that code not using Psycho is absolu

Re: proposal, change self. to .

2008-08-05 Thread Russ P.
On Aug 3, 5:44 am, Nick Dumas <[EMAIL PROTECTED]> wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > It's also worth noting that you can use a different name for the object > that represents your class. If you did def __init__(foo):pass, then you > would be able to access the class's obje

RE: Password prompt with mask

2008-08-05 Thread Neuberger, Sheldon N.
> Could I write my own if one does not exist? Take a look at the getpass.py module. It's very short. The windows version of the getpass function can be trivially modified to echo something. The unix version is just as short but a bit more complicated. def win_getpass(prompt='Password: ', stream=N

Re: regex question

2008-08-05 Thread MRAB
On Aug 5, 11:39 am, Fred Mangusta <[EMAIL PROTECTED]> wrote: > Hi, > > I would like to delete all the instances of a '.' into a number. > > In other words I'd like to replace all the instances of a '.' character > with something (say nothing at all) when the '.' is representing a > decimal separato

Re: interpreter vs. compiled

2008-08-05 Thread Chris Mellon
On Tue, Aug 5, 2008 at 12:12 PM, castironpi <[EMAIL PROTECTED]> wrote: > On Aug 5, 9:21 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > wrote: >> On Aug 3, 1:26 am, castironpi <[EMAIL PROTECTED]> wrote: >> >> >> > Which is 12 bytes long and runs in a millisecond. What it does is set >> > a memory ad

Re: Brainwave: A Complete Web Platform With Database Out of the Box

2008-08-05 Thread Michael Mabin
Actually this is not my web site or my product. But this is the kind of tough love I'd like the creators to read. On Tue, Aug 5, 2008 at 10:36 AM, Avinash Vora <[EMAIL PROTECTED]> wrote: > On Aug 5, 2008, at 8:37 PM, Michael Mabin wrote: > > Brainwave is a complete Web Development Platform with a

Re: Difference between type and class

2008-08-05 Thread Terry Reedy
Gabriel Genellina wrote: A decade ago, in 1.x, 'types' were built-in classes. They were instances of class 'type'. 'Classes' were user-defined classes. They were instances of (built-in) class 'classob'. User classes had the same status as instances of any other built-in class. They could o

Re: interpreter vs. compiled

2008-08-05 Thread [EMAIL PROTECTED]
Regarding exploring processor instructions. Lets say you compile a C program targeting x86 architecture, with optimizations turned on for speed, and let the compiler automatic select MMX and SSE instructions for numeric code. I have now a program that executes very fast, and does what I want very

Re: Link Checking Issues - Sub domains

2008-08-05 Thread Terry Reedy
rpupkin77 wrote: Hi, I have written this script to run as a cron that will loop through a text file with a list of urls. It works fine for most of the links, however there are a number of urls which are subdomains (they are government sites) such as http://basename.airforce.mil, these links ar

Re: Print statement isn't showing up?

2008-08-05 Thread Timothy Grant
On Tue, Aug 5, 2008 at 9:09 AM, Robert Dailey <[EMAIL PROTECTED]> wrote: > Hi, > > I have the following code: > > > def ReplaceExternalWithCopy( localDir, remoteDir ): > print "Removing external local directory:", localDir > rmdirs( localDir ) > vfxrepo.copy( remoteDir, localDir ) > > I

Re: Redirecting stderr and stdout to syslog

2008-08-05 Thread Matthew Woodcraft
In article <[EMAIL PROTECTED]>, > How do I redirect ALL stderr stuff to syslog, even stderr from > external programs that don't explicitly change their own stderr? Sending messages to syslog involves more than writing to a file descriptor, so there's no way to make this happen without having som

Re: Print statement isn't showing up?

2008-08-05 Thread Robert Dailey
On Tue, Aug 5, 2008 at 2:28 PM, Timothy Grant <[EMAIL PROTECTED]>wrote: > On Tue, Aug 5, 2008 at 9:09 AM, Robert Dailey <[EMAIL PROTECTED]> wrote: > > Hi, > > > > I have the following code: > > > > > > def ReplaceExternalWithCopy( localDir, remoteDir ): > > print "Removing external local direc

  1   2   >