Python-URL! - weekly Python news and links (Jul 6)

2009-07-07 Thread Gabriel Genellina
QOTW: Simulating a shell with hooks on its I/O should be so complicated that a 'script kiddie' has trouble writing a Trojan. - Scott David Daniels http://groups.google.com/group/comp.lang.python/msg/1c0f70d5fc69b5aa Python 3.1 final was released last week - congratulations!

Python review article (econometrics statistics)

2009-07-07 Thread Steve Lawford
Dear all, We have written a review of Python aimed at econometricians and statisticians: http://www.enac.fr/recherche/leea/Steve%20Lawford/papers/python.pdf Some of the introductory material and examples may be of general interest. Comments are very welcome (steve_lawf...@yahoo.co.uk). Best,

DjangoCon '09

2009-07-07 Thread Robert Lofthouse
Hi all, DjangoCon '09 will be in Portland, Oregon at the DoubleTree Green Hotel ( http://www.doubletreegreen) between 8th and 12th September. The first 3 days are conference days and the last 2 days are sprint days. You can register at the early bird rates at http://djangocon09.eventbrite.com

Re: Clarity vs. code reuse/generality

2009-07-07 Thread Steven D'Aprano
On Tue, 07 Jul 2009 05:13:28 +, Lie Ryan wrote: When people are fighting over things like `sense`, although sense may not be strictly wrong dictionary-wise, it smells of something burning... That would be my patience. I can't believe the direction this discussion has taken. Anybody

Re: Python and webcam capture delay?

2009-07-07 Thread jack catcher (nick)
Nobody kirjoitti: On Mon, 06 Jul 2009 20:41:03 +0300, jack catcher (nick) wrote: Does the webcam just deliver frames, or are you getting frames out of a decoder layer? If it's the latter, you want to distribute the encoded video, which should be much lower bandwidth. Exactly how you do that

Re: parsing times like 5 minutes ago?

2009-07-07 Thread Paul McGuire
On Jul 6, 7:21 pm, m...@pixar.com wrote: I'm looking for something like Tcl's [clock scan] command which parses human-readable time strings such as:     % clock scan 5 minutes ago     1246925569     % clock scan tomorrow 12:00     1246993200     % clock scan today + 1 fortnight    

Re: why PyObject_VAR_HEAD?

2009-07-07 Thread Eric Wong
kio wrote: Hi, I'm studying the CPython source code. I don’t quite understand why they’re using PyObject_VAR_HEAD to define struct like PyListObject. To define such kind of struct, could I use _PyObject_HEAD_EXTRA as a header and add items pointer and allocated count explicity? Is there

Re: A Bug By Any Other Name ...

2009-07-07 Thread Chris Rebert
On Mon, Jul 6, 2009 at 10:13 PM, Steven D'Apranost...@remove-this-cybersource.com.au wrote: On Tue, 07 Jul 2009 04:51:51 +, Lie Ryan wrote: Chris Rebert wrote: On Mon, Jul 6, 2009 at 1:29 AM, Lawrence D'Oliveirol...@geek-central.gen.new_zealand wrote: In message

Re: Opening a SQLite database in readonly mode

2009-07-07 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Joshua Kugler wrote: BTW, APSW is written by the same author as pysqlite. Not even remotely true :-) pysqlite was written by various people, with the maintainer of the last several years being Gerhard Häring. I am the (sole) author of APSW and

Re: Code that ought to run fast, but can't due to Python limitations.

2009-07-07 Thread John Nagle
Steven D'Aprano wrote: On Sun, 05 Jul 2009 01:58:13 -0700, Paul Rubin wrote: Steven D'Aprano st...@remove-this-cybersource.com.au writes: Okay, we get it. Parsing HTML 5 is a bitch. What's your point? I don't see how a case statement would help you here: you're not dispatching on a value, but

Re: Code that ought to run fast, but can't due to Python limitations.

2009-07-07 Thread John Nagle
Steven D'Aprano wrote: On Sun, 05 Jul 2009 10:12:54 +0200, Hendrik van Rooyen wrote: Python is not C. John Nagle is an old hand at Python. He's perfectly aware of this, and I'm sure he's not trying to program C in Python. I'm not entirely sure *what* he is doing, and hopefully he'll speak

Re: module name versus function name resolution conflict.

2009-07-07 Thread Peter Otten
rocky wrote: Someone recently reported a problem in pydb where a function defined in his program was conflicting with a module name that pydb uses. I think I understand what's wrong, but I don't have any elegant solutions to the problem. Suggestions would be appreciated. In a nutshell,

Re: copytree with timeout in windows

2009-07-07 Thread Astan Chee
Tim Golden wrote: Astan Chee wrote: Hi, I'm trying to modify the copytree function in shutil so that any file being copied does not take more than 5 minutes (if it does, skip to the next one). One suggestion is to use the CopyFileEx API exposed in the win32file module from pywin32.

Re: How Python Implements long integer?

2009-07-07 Thread Eric Wong
Pedram wrote: Hello Mr. Dickinson. Glad to see you again :) On Jul 6, 5:46 pm, Mark Dickinson dicki...@gmail.com wrote: On Jul 6, 1:24 pm, Pedram pm567...@gmail.com wrote: OK, fine, I read longobject.c at last! :) I found that longobject is a structure like this: struct _longobject {

Re: Looking for a slick way to classify relationship between two numbers, without tons of if/else

2009-07-07 Thread Paul Rubin
palewire ben.we...@gmail.com writes: In my application, I'd like to have a function that compares two values, either of which may be null, and then classify the result depending on whether one is higher or lower than the other. Didn't we just have a huge thread about that? Using a special

Re: copytree with timeout in windows

2009-07-07 Thread Tim Golden
Astan Chee wrote: Tim Golden wrote: Astan Chee wrote: Hi, I'm trying to modify the copytree function in shutil so that any file being copied does not take more than 5 minutes (if it does, skip to the next one). One suggestion is to use the CopyFileEx API exposed in the win32file

Re: Semi-Newbie needs a little help

2009-07-07 Thread Piet van Oostrum
Nile nile_mcad...@yahoo.com (N) wrote: N I initialized the dictionary earlier in the program like this - N hashtable = {} N I changed the dict to hashtable but I still get the same result N I will try to learn about the defaultdict but I'm just trying to keep N it as simple as I can for now

Re: Where does setuptools live?

2009-07-07 Thread Chris Withers
David Lyon wrote: setuptools... as far as I can see isn't actually installed until you install easyinstall... That depends... I exclusively use buildout to manage my python packages, and sadly that relies on setuptools... Pip (http://pypi.python.org/pypi/pip) and enstall

Re: Clarity vs. code reuse/generality

2009-07-07 Thread Asun Friere
On Jul 7, 3:05 pm, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: [snip] Sense is, if you like, a signed direction. Or to put it another way, in the graphical representation of a vector, 'direction' is the line, 'sense' is the arrowhead. --

Re: A Bug By Any Other Name ...

2009-07-07 Thread Duncan Booth
Dennis Lee Bieber wlfr...@ix.netcom.com wrote: for, if, and return were common keywords in FORTRAN. Really? What does 'for' do in FORTRAN? P.S. Does FORTRAN actually have keywords these days? Back when I learned it there was no such thing as a reserved word though for all I know they may

Re: Code that ought to run fast, but can't due to Python limitations.

2009-07-07 Thread Stefan Behnel
John Nagle wrote: I have a small web crawler robust enough to parse real-world HTML, which can be appallingly bad. I currently use an extra-robust version of BeautifulSoup, and even that sometimes blows up. So I'm very interested in a new Python parser which supposedly handles bad HTML

Re: How Python Implements long integer?

2009-07-07 Thread Mark Dickinson
On Jul 6, 4:13 pm, Pedram pm567...@gmail.com wrote: On Jul 6, 5:46 pm, Mark Dickinson dicki...@gmail.com wrote: On Jul 6, 1:24 pm, Pedram pm567...@gmail.com wrote: OK, fine, I read longobject.c at last! :) I found that longobject is a structure like this: struct _longobject {    

Re: a little wsgi framework

2009-07-07 Thread Bruno Desthuilliers
timmyt a écrit : i'm interested in getting opinions on a small wsgi framework i assembled from webob, sqlalchemy, genshi, and various code fragments i found on the inter-tubes here is the interesting glue - any comments / suggestions would be much appreciated meta Well... My first comment

Re: A Bug By Any Other Name ...

2009-07-07 Thread Bruno Desthuilliers
Daniel Fetchinson a écrit : (snip) and my point is that users are most of time correct when they assume that something will work the same way as in C. Oh, really ? They would surely be wrong if they'd expect the for loop to have any similarity with a C for loop, or - a *very* common error -

Re: A Bug By Any Other Name ...

2009-07-07 Thread Bruno Desthuilliers
Daniel Fetchinson a écrit : Yes, there are plenty of languages other than Java and C, but the influence of C is admittedly huge in Python. Why do you think loops are called for, conditionals if or while, functions return via return, loops terminate via break and keep going via continue and why

Re: module name versus function name resolution conflict.

2009-07-07 Thread rocky
On Jul 7, 2:33 am, Peter Otten __pete...@web.de wrote: rocky wrote: Someone recently reported a problem in pydb where a function defined in his program was conflicting with amodulenamethat pydb uses. I think I understand what's wrong, but I don't have any elegant solutions to the problem.

Re: Method to separate unit-test methods and data?

2009-07-07 Thread Lie Ryan
Nick Daly wrote: Hi, I was wondering if it's possible / if there are any simple methods known of storing unit-test functions and their data in separate files? Perhaps this is a strange request, but it does an excellent job of modularizing code. As far as revision control goes, it makes

Re: How Python Implements long integer?

2009-07-07 Thread Pedram
On Jul 7, 1:10 pm, Mark Dickinson dicki...@gmail.com wrote: On Jul 6, 4:13 pm, Pedram pm567...@gmail.com wrote: On Jul 6, 5:46 pm, Mark Dickinson dicki...@gmail.com wrote: On Jul 6, 1:24 pm, Pedram pm567...@gmail.com wrote: OK, fine, I read longobject.c at last! :) I found that

Re: generation of keyboard events

2009-07-07 Thread RAM
On 6 July, 10:02, Simon Brunning si...@brunningonline.net wrote: 2009/7/6 RAM serverin2...@yahoo.com: I am trying to do this on windows. My program(executable) has been written in VC++ and when I run this program, I need to click on one button on the program GUI i,e just I am entering

ISO library ref in printed form

2009-07-07 Thread kj
Does anyone know where I can buy the Python library reference in printed form? (I'd rather not print the whole 1200+-page tome myself.) I'm interested in both/either 2.6 and 3.0. TIA! kj -- http://mail.python.org/mailman/listinfo/python-list

Re: Why re.match()?

2009-07-07 Thread Bruno Desthuilliers
kj a écrit : In 4a4e2227$0$7801$426a7...@news.free.fr Bruno Desthuilliers bruno.42.desthuilli...@websiteburo.invalid writes: kj a écrit : (snipo To have a special-case re.match() method in addition to a general re.search() method is antithetical to language minimalism, FWIW, Python has no

Python/pyobjC Apps on iPhone now a possibility?

2009-07-07 Thread Dr Mephesto
I have been following the discussion about python and pyobjc on the iphone, and it seemed to me that the app-store rules prohibited embedded interpreters; so, python apps are a no-no. But now it seems that the Rubyists have the option that we don't. It seems there is a company,

Re: A Bug By Any Other Name ...

2009-07-07 Thread Steven D'Aprano
On Mon, 06 Jul 2009 22:18:20 -0700, Chris Rebert wrote: Not so rare. Decimal uses unary plus. Don't assume +x is a no-op. [...] Well, yes, but when would you apply it twice in a row? My point was that unary + isn't a no-op, and therefore neither is ++. For Decimal, I can't think why you'd

Re: Where does setuptools live?

2009-07-07 Thread David Lyon
On Tue, 07 Jul 2009 09:06:49 +0100, Chris Withers ch...@simplistix.co.uk wrote: What hasn't happened is enough testing of pypi packages and installing with setuptools/pip/enstall from pypi. What needs testing? It's software... therefore it needs testing... David --

Re: Where does setuptools live?

2009-07-07 Thread Chris Withers
David Lyon wrote: On Tue, 07 Jul 2009 09:06:49 +0100, Chris Withers ch...@simplistix.co.uk wrote: What hasn't happened is enough testing of pypi packages and installing with setuptools/pip/enstall from pypi. What needs testing? It's software... therefore it needs testing... Yes, which is

Re: Why re.match()?

2009-07-07 Thread Paul Rudin
Bruno Desthuilliers bruno.42.desthuilli...@websiteburo.invalid writes: kj a écrit : In 4a4e2227$0$7801$426a7...@news.free.fr Bruno Desthuilliers bruno.42.desthuilli...@websiteburo.invalid writes: kj a écrit : (snipo To have a special-case re.match() method in addition to a general

Re: Where does setuptools live?

2009-07-07 Thread David Lyon
On Tue, 07 Jul 2009 13:07:48 +0100, Chris Withers ch...@simplistix.co.uk wrote: What hasn't happened is enough testing of pypi packages and installing with setuptools/pip/enstall from pypi. What needs testing? It's software... therefore it needs testing... Yes, which is why I asked WHAT

Re: Where does setuptools live?

2009-07-07 Thread Chris Withers
David Lyon wrote: I've written a package manager gui. I think it is orderly to comprehensively ascertain which packages will and won't install from pypi with the tool. I'll run the same install test for pip, easyinstall and enstall. And come up with a preferred installer. Which I will then

Tkinter.Canvas thread safety problem?

2009-07-07 Thread Zdenek Maxa
Hello, I have started a project using Tkinter. The application performs some regular checks in a thread and updates Canvas components. I have observed that sometimes the application hangs when it is about to call canvas.itemconfig() when the thread is about to terminate in the next loop.

Re: Clarity vs. code reuse/generality

2009-07-07 Thread Jean-Michel Pichavant
Steven D'Aprano wrote: On Tue, 07 Jul 2009 05:13:28 +, Lie Ryan wrote: When people are fighting over things like `sense`, although sense may not be strictly wrong dictionary-wise, it smells of something burning... That would be my patience. I can't believe the direction this

Re: Clarity vs. code reuse/generality

2009-07-07 Thread Lie Ryan
Steven D'Aprano wrote: On Tue, 07 Jul 2009 05:13:28 +, Lie Ryan wrote: When people are fighting over things like `sense`, although sense may not be strictly wrong dictionary-wise, it smells of something burning... That would be my patience. I can't believe the direction this

Re: Python Error from Apress book

2009-07-07 Thread Dave Angel
Gabriel Genellina wrote: div class=moz-text-flowed style=font-family: -moz-fixedEn Mon, 06 Jul 2009 19:56:40 -0300, matt0177 matt0...@gmail.com escribió: When I try to run the command as outlined in the book simple_markup2.py test_input.txt test_output.html i get the following error every

Re: parsing times like 5 minutes ago?

2009-07-07 Thread Stefan Behnel
m...@pixar.com wrote: I'm looking for something like Tcl's [clock scan] command which parses human-readable time strings such as: % clock scan 5 minutes ago 1246925569 % clock scan tomorrow 12:00 1246993200 % clock scan today + 1 fortnight 1248135628 Does any

Re: A Bug By Any Other Name ...

2009-07-07 Thread MRAB
Dennis Lee Bieber wrote: On Mon, 6 Jul 2009 19:48:39 -0700, Daniel Fetchinson fetchin...@googlemail.com declaimed the following in gmane.comp.python.general: Yes, there are plenty of languages other than Java and C, but the influence of C is admittedly huge in Python. Why do you think loops

Re: Python/pyobjC Apps on iPhone now a possibility?

2009-07-07 Thread J Kenneth King
Dr Mephesto dnh...@googlemail.com writes: I have been following the discussion about python and pyobjc on the iphone, and it seemed to me that the app-store rules prohibited embedded interpreters; so, python apps are a no-no. But now it seems that the Rubyists have the option that we don't.

Re: module name versus function name resolution conflict.

2009-07-07 Thread Dave Angel
rocky wrote: Someone recently reported a problem in pydb where a function defined in his program was conflicting with a module name that pydb uses. I think I understand what's wrong, but I don't have any elegant solutions to the problem. Suggestions would be appreciated. In a nutshell, here's

Re: How to map size_t using ctypes?

2009-07-07 Thread Philip Semanchuk
On Jul 6, 2009, at 11:51 PM, Gabriel Genellina wrote: En Mon, 06 Jul 2009 13:29:21 -0300, Philip Semanchuk phi...@semanchuk.com escribió: On Jul 6, 2009, at 12:10 PM, Diez B. Roggisch wrote: Philip Semanchuk wrote: I can't figure out how to map a C variable of size_t via Python's ctypes

Re: Tkinter.Canvas thread safety problem?

2009-07-07 Thread Diez B. Roggisch
Zdenek Maxa wrote: Hello, I have started a project using Tkinter. The application performs some regular checks in a thread and updates Canvas components. I have observed that sometimes the application hangs when it is about to call canvas.itemconfig() when the thread is about to terminate

Re: Python/pyobjC Apps on iPhone now a possibility?

2009-07-07 Thread Dr Mephesto
Sure, I am learning Objective C already, but the syntax is really unfriendly after python. I think it really depends on the type of app you want to write. Anything held back by network delays or that sits around waiting for user input are perfectly acceptable target apps. If you need speed for

Re: Why re.match()?

2009-07-07 Thread Bruno Desthuilliers
Paul Rudin a écrit : Bruno Desthuilliers bruno.42.desthuilli...@websiteburo.invalid writes: kj a écrit : In 4a4e2227$0$7801$426a7...@news.free.fr Bruno Desthuilliers bruno.42.desthuilli...@websiteburo.invalid writes: kj a écrit : (snipo To have a special-case re.match() method in addition

Re: A Bug By Any Other Name ...

2009-07-07 Thread Dave Angel
Duncan Booth wrote: Dennis Lee Bieber wlfr...@ix.netcom.com wrote: for, if, and return were common keywords in FORTRAN. Really? What does 'for' do in FORTRAN? P.S. Does FORTRAN actually have keywords these days? Back when I learned it there was no such thing as a reserved word

Re: Why re.match()?

2009-07-07 Thread pdpi
On Jul 2, 4:49 am, kj no.em...@please.post wrote: In xns9c3bca27abc36duncanbo...@127.0.0.1 Duncan Booth duncan.bo...@invalid.invalid writes: So, for example: re.compile(c).match(abcdef, 2) _sre.SRE_Match object at 0x02C09B90 re.compile(^c).search(abcdef, 2) I find this

Re: Creating alot of class instances?

2009-07-07 Thread Piet van Oostrum
Steven D'Aprano st...@remove-this-cybersource.com.au (SD) wrote: SD On Mon, 06 Jul 2009 05:47:18 -0700, Scott David Daniels wrote: Steven D'Aprano wrote: ... That's the Wrong Way to do it -- you're using a screwdriver to hammer a nail Don't knock tool abuse (though I agree with you

Re: Semi-Newbie needs a little help

2009-07-07 Thread Nile
Thanks all for your help. I appreciate it. The problem was in the function. A simple bug which I should have caught but I had my mental blinders on and was sure the problem was outside the function. The answers have given me a lot to learn so thanks for that as well. --

Re: Problem reading file with umlauts

2009-07-07 Thread Stefan Behnel
Claus Hausberger wrote: Hello I have a text file with is encoding in Latin1 (ISO-8859-1). I can't change that as I do not create those files myself. I have to read those files and convert the umlauts like ö to stuff like oumol; as the text files should become html files. I have this

Re: Tkinter.Canvas thread safety problem?

2009-07-07 Thread Peter Otten
Zdenek Maxa wrote: I would like to ask if you could have a look at the snippet in the attachment and tell me if that is actually me doing something wrong or indeed Tkinter thread safety problem and what the workaround could be. http://effbot.org/zone/tkinter-threads.htm --

Problem reading file with umlauts

2009-07-07 Thread Claus Hausberger
Hello I have a text file with is encoding in Latin1 (ISO-8859-1). I can't change that as I do not create those files myself. I have to read those files and convert the umlauts like ö to stuff like oumol; as the text files should become html files. I have this code: #!/usr/bin/python # -*-

Re: Newbie needs help

2009-07-07 Thread Simon Forman
On Mon, Jul 6, 2009 at 7:00 PM, nacim_br...@agilent.com wrote: Dear Python gurus, If I'd like to set dielectric constant for the certain material, is it possible to do such in Python environment? If yes, how to do or what syntax can be used? Also, I'd like to get a simulation result, like

Re: Catching control-C

2009-07-07 Thread Simon Forman
On Jul 6, 6:02 pm, Michael Mossey michaelmos...@gmail.com wrote: On Jul 6, 2:47 pm, Philip Semanchuk phi...@semanchuk.com wrote: On Jul 6, 2009, at 5:37 PM, Michael Mossey wrote: What is required in a python program to make sure it catches a   control- c on the command-line? Do some

Re: Clarity vs. code reuse/generality

2009-07-07 Thread Aahz
In article mailman.2765.1246971084.8015.python-l...@python.org, Jean-Michel Pichavant jeanmic...@sequans.com wrote: Can't we just calm down ? I'm really sorry my ignorance started this thread, and my apologies go to Kj who's obviously more fluent in english than me. I've never used sense in

Re: Clarity vs. code reuse/generality

2009-07-07 Thread Simon Forman
On Tue, Jul 7, 2009 at 8:51 AM, Jean-Michel Pichavantjeanmic...@sequans.com wrote: Steven D'Aprano wrote: On Tue, 07 Jul 2009 05:13:28 +, Lie Ryan wrote: When people are fighting over things like `sense`, although sense may not be strictly wrong dictionary-wise, it smells of something

Re: Python/pyobjC Apps on iPhone now a possibility?

2009-07-07 Thread Aahz
In article 85ljn0ej4h@agentultra.com, J Kenneth King ja...@agentultra.com wrote: The iPhone is running on what? A 400Mhz ARM processor? Resources on the device are already limited; running your program on top of an embedded Python interpreter would only be adding pressure to the constraints;

Re: Remoting over SSH

2009-07-07 Thread alex23
On Jul 8, 12:46 am, Hussein B hubaghd...@gmail.com wrote: I want to perform commands on a remote server over SSH. What do I need? Take a look at pexpect: http://pexpect.sourceforge.net/pexpect.html -- http://mail.python.org/mailman/listinfo/python-list

Re: Remoting over SSH

2009-07-07 Thread Tim Harig
On 2009-07-07, Hussein B hubaghd...@gmail.com wrote: I want to perform commands on a remote server over SSH. What do I need? catb.org/esr/faqs/smart-questions.html There are many ways to remote using ssh. If we know what you are trying to do, maybe we could give you a better answer. If you

Re: Python Error from Apress book

2009-07-07 Thread matt0177
Adding the python before the command line didn't work at first, but upon moving the files to the c:\python25 it worked like a champ. Thank you both for the help. Very frustrating to run into stuff like this when you're first trying to learn a knew language, it really throws off your momentum! --

RE: Newbie needs help

2009-07-07 Thread nacim_bravo
Hello Gurus, Thank you for trying to help to my initial and not well written questions. I will compile more detailed information and ask again. Btw, I am giving a glimpse to: How To Ask Questions The Smart Way. nacim -Original Message- From: Simon Forman

Re: ISO library ref in printed form

2009-07-07 Thread Scott David Daniels
kj wrote: Does anyone know where I can buy the Python library reference in printed form? (I'd rather not print the whole 1200+-page tome myself.) I'm interested in both/either 2.6 and 3.0. Personally, I'd get the new Beazley's Python Essential Reference, which is due out real soon now, and

Re: Problem reading file with umlauts

2009-07-07 Thread Michiel Overtoom
Claus Hausberger wrote: I have a text file with is encoding in Latin1 (ISO-8859-1). I can't change that as I do not create those files myself. I have to read those files and convert the umlauts like ö to stuff like oumol; as the text files should become html files. umlaut-in.txt: This

Re: Newbie needs help

2009-07-07 Thread Pablo Torres N.
On Tue, Jul 7, 2009 at 10:02, nacim_br...@agilent.com wrote: Hello Gurus, Thank you for trying to help to my initial and not well written questions.  I will compile more detailed information and ask again.  Btw, I am giving a glimpse to: How To Ask Questions The Smart Way. nacim Give

automatic multiprocessing

2009-07-07 Thread Cheng Soon Ong
Hi all, I'm trying to automate the use of multiprocessing when it is available. The setting I have is quite simple, with a for loop where the operations inside are independent of each other. Here's a bit of code. function_inputs is a list of dictionaries, each of which match the signature of

Re: ISO library ref in printed form

2009-07-07 Thread Aahz
In article h2vcp9$66...@reader1.panix.com, kj no.em...@please.post wrote: Does anyone know where I can buy the Python library reference in printed form? (I'd rather not print the whole 1200+-page tome myself.) I'm interested in both/either 2.6 and 3.0. There used to be one for Python 2.1, but

Re: Python Error from Apress book

2009-07-07 Thread Dave Angel
matt0177 wrote: Adding the python before the command line didn't work at first, but upon moving the files to the c:\python25 it worked like a champ. Thank you both for the help. Very frustrating to run into stuff like this when you're first trying to learn a knew language, it really throws off

Re: A Bug By Any Other Name ...

2009-07-07 Thread Daniel Fetchinson
(snip) and my point is that users are most of time correct when they assume that something will work the same way as in C. Oh, really ? They would surely be wrong if they'd expect the for loop to have any similarity with a C for loop, or - a *very* common error - if they'd expect

Re: automatic multiprocessing

2009-07-07 Thread Simon Forman
On Jul 7, 11:08 am, Cheng Soon Ong chengsoon@inf.ethz.ch wrote: Hi all, I'm trying to automate the use of multiprocessing when it is available. The setting I have is quite simple, with a for loop where the operations inside are independent of each other. Here's a bit of code.

Re: A Bug By Any Other Name ...

2009-07-07 Thread Daniel Fetchinson
Yes, there are plenty of languages other than Java and C, but the influence of C is admittedly huge in Python. Why do you think loops are called for, conditionals if or while, functions return via return, loops terminate via break and keep going via continue and why is comparison written as

Re: A Bug By Any Other Name ...

2009-07-07 Thread Daniel Fetchinson
and my point is that users are most of time correct when they assume that something will work the same way as in C. Oh, really ? They would surely be wrong if they'd expect the for loop to have any similarity with a C for loop, or - a *very* common error - if they'd expect assignment to

Re: Problem reading file with umlauts

2009-07-07 Thread Stefan Behnel
Michiel Overtoom schrob: Viele Röhre. Macht spaß! Tsüsch! LOL! :) Stefan -- http://mail.python.org/mailman/listinfo/python-list

DBI module deprecated at Python 2.5--what to use in its place?

2009-07-07 Thread dana
I have a variety of Python 2.4 scripts that utilitize the DBI and ODBC modules together. Although I don't have Python 2.5, I've been informed the DBI module has been deprecated at 2.5. A few questions: 1) Although deprecated, will it work at all in 2.5? Does the fact that it is deprecrated mean

Re: Code that ought to run fast, but can't due to Python limitations.

2009-07-07 Thread John Nagle
Stefan Behnel wrote: John Nagle wrote: I have a small web crawler robust enough to parse real-world HTML, which can be appallingly bad. I currently use an extra-robust version of BeautifulSoup, and even that sometimes blows up. So I'm very interested in a new Python parser which

Re: A Bug By Any Other Name ...

2009-07-07 Thread MRAB
Daniel Fetchinson wrote: and my point is that users are most of time correct when they assume that something will work the same way as in C. Oh, really ? They would surely be wrong if they'd expect the for loop to have any similarity with a C for loop, or - a *very* common error - if they'd

Re: Unable to get Tkinter menubar to appear under OS X

2009-07-07 Thread weforgottenuno
I'm having the same problem, though I am just using the pre-installed python and tkinter versions that are on my OS X 10.5 computer, I did not install them on my own. Any advice? -Doug On Jun 24, 9:22 am, Eric Winter elwin...@verizon.net wrote: Hi all. I've googled this issue several times and

Re: Python/pyobjC Apps on iPhone now a possibility?

2009-07-07 Thread Piet van Oostrum
a...@pythoncraft.com (Aahz) (A) wrote: A In article 85ljn0ej4h@agentultra.com, A J Kenneth King ja...@agentultra.com wrote: The iPhone is running on what? A 400Mhz ARM processor? Resources on the device are already limited; running your program on top of an embedded Python interpreter

Re: Where does setuptools live?

2009-07-07 Thread Inky 788
On Jul 7, 4:06 am, Chris Withers ch...@simplistix.co.uk wrote: David Lyon wrote: What hasn't happened is enough testing of pypi packages and installing with setuptools/pip/enstall from pypi. What needs testing? More important for me is which of these has the most active development

Re: Clarity vs. code reuse/generality

2009-07-07 Thread Paul Rubin
pdpi pdpinhe...@gmail.com writes: Personally, I think the code is an unreadable mess, but that's mostly because of all the micro optimizations, not the generality of it. Here's my unoptimized, but still equally generic, version: That version doesn't use sense inside the binary search, i.e. it

Re: Clarity vs. code reuse/generality

2009-07-07 Thread Andre Engels
On Tue, Jul 7, 2009 at 8:01 PM, pdpipdpinhe...@gmail.com wrote: He asserts:    assert lo hi but then compares:    sense = cmp(func(hi), func(lo)) sense can't ever be anything other than 1. It can - there is no necessity that func is monotonically increasing. -- André Engels,

Re: Clarity vs. code reuse/generality

2009-07-07 Thread pdpi
On Jul 7, 7:26 pm, Andre Engels andreeng...@gmail.com wrote: On Tue, Jul 7, 2009 at 8:01 PM, pdpipdpinhe...@gmail.com wrote: He asserts:    assert lo hi but then compares:    sense = cmp(func(hi), func(lo)) sense can't ever be anything other than 1. It can - there is no necessity

Re: Clarity vs. code reuse/generality

2009-07-07 Thread pdpi
On Jul 7, 7:06 pm, Paul Rubin http://phr...@nospam.invalid wrote: pdpi pdpinhe...@gmail.com writes: Personally, I think the code is an unreadable mess, but that's mostly because of all the micro optimizations, not the generality of it. Here's my unoptimized, but still equally generic,

Re: Clarity vs. code reuse/generality

2009-07-07 Thread pdpi
On Jul 7, 7:31 pm, pdpi pdpinhe...@gmail.com wrote: On Jul 7, 7:06 pm, Paul Rubin http://phr...@nospam.invalid wrote: pdpi pdpinhe...@gmail.com writes: Personally, I think the code is an unreadable mess, but that's mostly because of all the micro optimizations, not the generality of it.

Re: Problem reading file with umlauts

2009-07-07 Thread Claus Hausberger
Thanks a lot. Now I am one step further but I get another strange error: Traceback (most recent call last): File ./read.py, line 12, in module of.write(text) UnicodeEncodeError: 'ascii' codec can't encode character u'\ufeff' in position 0: ordinal not in range(128) according to google

Re: Clarity vs. code reuse/generality

2009-07-07 Thread Dave Angel
pdpi wrote: On Jul 7, 2:16 am, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: On Mon, 06 Jul 2009 16:43:43 +0100, Tim Rowe wrote: 2009/7/4 kj no.em...@please.post: Precisely. As I've stated elsewhere, this is an internal helper function, to be called only a few

Re: Clarity vs. code reuse/generality

2009-07-07 Thread pdpi
On Jul 7, 8:04 pm, Dave Angel da...@ieee.org wrote: And of course your clarified function will fail if the func is monotonically decreasing. yeah, I eventually realized that and corrected it... And the assert()/ cmp() confusion too. I blame lack of sleep. The whole sign/sense thing left a

Re: Python Error from Apress book

2009-07-07 Thread Dave Angel
Matthew Edmondson wrote: Thanks a ton for the help. At first adding the path didn't work, but after restarting my computer, ran like a champ :) Hopefully I can get decent with this language one day! All you needed was to restart the DOS-box (Command Prompt), after you did the control-panel

Check file is locked?

2009-07-07 Thread dudeja . rajat
How to check if a particular file is locked by some application? (i.e. the file is opened by some application)? -- Regrads, Rajat -- http://mail.python.org/mailman/listinfo/python-list

Re: ISO library ref in printed form

2009-07-07 Thread kj
In h2vpko$jp...@panix3.panix.com a...@pythoncraft.com (Aahz) writes: In article h2vcp9$66...@reader1.panix.com, kj no.em...@please.post wrote: Does anyone know where I can buy the Python library reference in printed form? (I'd rather not print the whole 1200+-page tome myself.) I'm interested

Re: ISO library ref in printed form

2009-07-07 Thread kj
In yrcdnen05dnx_s7xnz2dnuvz_sudn...@pdx.net Scott David Daniels scott.dani...@acm.org writes: Also consider grabbing Gruet's Python Quick Reference page. Not quite what I had in mind, but handy all the same. Thanks. kj -- http://mail.python.org/mailman/listinfo/python-list

library search path when compiling python

2009-07-07 Thread nn
I am trying to compile python with ssl support but the libraries are not in /usr/lib but in /opt/freeware/lib. How do I add that folder to the default library search path? It looks like configure --libdir=DIR might do the job but I don't want to replace the default lib search path, just add an

tough-to-explain Python

2009-07-07 Thread kj
I'm having a hard time coming up with a reasonable way to explain certain things to programming novices. Consider the following interaction sequence: def eggs(some_int, some_list, some_tuple): ... some_int += 2 ... some_list += [2] ... some_tuple += (2,) ... x = 42 y = (42,) z

Re: library search path when compiling python

2009-07-07 Thread Christian Heimes
nn wrote: I am trying to compile python with ssl support but the libraries are not in /usr/lib but in /opt/freeware/lib. How do I add that folder to the default library search path? It looks like configure --libdir=DIR might do the job but I don't want to replace the default lib search

Re: Check file is locked?

2009-07-07 Thread Christian Heimes
dudeja.ra...@gmail.com wrote: How to check if a particular file is locked by some application? (i.e. the file is opened by some application)? It depends on your operating system. By the way most operating systems don't lock a file when it's opened for reading or writing or even executed.

Re: tough-to-explain Python

2009-07-07 Thread Chris Rebert
On Tue, Jul 7, 2009 at 1:04 PM, kjno.em...@please.post wrote: I'm having a hard time coming up with a reasonable way to explain certain things to programming novices. Consider the following interaction sequence: def eggs(some_int, some_list, some_tuple): ...     some_int += 2 ...    

  1   2   >