Re: unicode bit me

2009-05-09 Thread anuraguni...@yahoo.com
also not sure why (python 2.5) print a # works print unicode(a) # works print [a] # works print unicode([a]) # doesn't works -- http://mail.python.org/mailman/listinfo/python-list

Re: Self function

2009-05-09 Thread George Sakkis
On May 6, 10:32 pm, Luis Alberto Zarrabeitia Gomez wrote: > A bit offtopic: a while ago I think I saw a recipe for a decorator that, via > bytecode hacks, would bind otherwise global names to the local namespace of > the > function. Can anyone remember it/point me to it? Maybe you saw http://co

Re: How to debug this import problem?

2009-05-09 Thread Iwan
Hi Scott, Diez, On May 8, 8:21 pm, Scott David Daniels wrote: > Diez B. Roggisch wrote: > > Try putting an "import pdb; pdb.set_trace()" on top of the decimal module. [snip] > You can also run Python with the "-v" or "-vv" flags to get output > about exactly what files are getting imported from t

Re: heapq.merge with key=

2009-05-09 Thread Peter Otten
Kevin D. Smith wrote: > On 2009-05-07 23:48:43 -0500, Chris Rebert said: > >> On Thu, May 7, 2009 at 2:23 PM, Kevin D. Smith >> wrote: >>> I need the behavior of heapq.merge to merge a bunch of results from a >>> database. I was doing this with sorted(itertools.chain(...), key= >> ...), but >

MacPython 3.0.1 installation problem, no /usr/local/bin/python*

2009-05-09 Thread Raoul Gough
I just installed MacPython 3.0.1 (woot!) but the installer didn't seem to do an absolutely complete job. According to the ReadMe.txt, "The installer puts [...] command-line tools in /usr/local/bin [...]". This didn't happen - even after the install reported Success, there were no python files or sy

Re: Decorating methods - where do my arguments go?

2009-05-09 Thread George Sakkis
On May 8, 11:33 am, Mikael Olofsson wrote: > Hi all! > > I have long tried to avoid decorators, but now I find myself in a > situation where I think they can help. I seem to be able to decorate > functions, but I fail miserably when trying to decorate methods. The > information I have been able t

Problems with datetime.datetime.strptime

2009-05-09 Thread Tuomas Vesterinen
I hoped that I could get rid of my special module _strptime2 when porting to Python 3.0. But testing is a disappointment. Python 3.0.1 (r301:69556, Apr 14 2009, 14:30:31) [GCC 4.1.2 20070925 (Red Hat 4.1.2-27)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>>

Re: [Python-Dev] PEP 382: little help for stupid people?

2009-05-09 Thread Chris Withers
Martin v. Löwis wrote: Ok, so create three tar files: 1. base.tar, containing simplistix/ simplistix/__init__.py So this __init__.py can have code in it? And base.tar can have other modules and subpackages in it? What happens if the base and an addon both define a package called simpl

Re: [Python-Dev] PEP 382: little help for stupid people?

2009-05-09 Thread Martin v. Löwis
>> Ok, so create three tar files: >> >> 1. base.tar, containing >> >>simplistix/ >>simplistix/__init__.py > > So this __init__.py can have code in it? That's the point, yes. > And base.tar can have other modules and subpackages in it? Certainly, yes. > What happens if the base and an

Re: ANN: Python process utility (psutil) 0.1.2 released

2009-05-09 Thread Nick Craig-Wood
Giampaolo Rodola' wrote: > psutil is a module providing an interface for retrieving information > on running processes and system utilization (CPU, memory) in a > portable way by using Python, implementing many functionalities > offered by tools like ps, top and Windows task manager. > It cur

Code - what could be done better?

2009-05-09 Thread Florian Wollenschein
Hi all, here's the main code of thc, my txt to html converter. Since I'm a beginner it is far, far, faaar away from perfect or even good :-) What could be done better? #!/usr/bin/env python # -*- coding: u

Re: IIR filter conversion routines for Python?

2009-05-09 Thread wzab
On May 8, 7:30 am, Dennis Lee Bieber wrote: > On Wed, 6 May 2009 11:03:57 -0700 (PDT), wzab > declaimed the following in gmane.comp.python.general: > > > Hi, > > I'm looking for procedures converting theIIRfilters into cascade and/ > > or parallel forms. Something like dir2cas.m or dir2par.m know

Re: unicode bit me

2009-05-09 Thread Piet van Oostrum
> "anuraguni...@yahoo.com" (ac) a écrit: >ac> also not sure why (python 2.5) >ac> print a # works >ac> print unicode(a) # works >ac> print [a] # works >ac> print unicode([a]) # doesn't works Which code do you use now? And what does this print? import sys print sys.stdout.encoding -- Piet

Re: ANN: Python process utility (psutil) 0.1.2 released

2009-05-09 Thread Piet van Oostrum
> "Giampaolo Rodola'" (GR) wrote: >GR> Hi, >GR> I'm pleased to announce the 0.1.2 release of psutil: >GR> http://code.google.com/p/psutil Very nice. I was just contemplating writing some python code to get information from ps (actually virtual memory size of the process) when your announceme

Re: IIR filter conversion routines for Python?

2009-05-09 Thread wzab
> In fact I have almost finished the simple dir2cas.py converter. > I'll post the source as soon, as it is ready. OK. So here it is as public domain code. Any hints and suggestions of improvements are appreciated. http://groups.google.com/group/alt.sources/browse_thread/thread/924fbe2255f8c42d -

Re: [Python-Dev] .pth files are evil

2009-05-09 Thread Zooko O'Whielacronx
.pth files are why I can't easily use GNU stow with easy_install. If installing a Python package involved writing new files into the filesystem, but did not require reading, updating, and re-writing any extant files such as .pth files, then GNU stow would Just Work with easy_install the way it Just

Re: [Python-Dev] PEP 382: little help for stupid people?

2009-05-09 Thread Chris Withers
Martin v. Löwis wrote: So this __init__.py can have code in it? That's the point, yes. And base.tar can have other modules and subpackages in it? Certainly, yes. Great, when is the PEP due to land in 2.x? ;-) What happens if the base and an addon both define a package called simplistix.

Re: Creating temperory files for a web application

2009-05-09 Thread Diez B. Roggisch
Hi Diez, I think I understood your point now. Is it ? (1) Have a separate URL for the image - update urls.py for that (2) Pass all the GET parameters to that URL again. (3) Recalculate the fields again in that URL (4) Create the image and send back as image/png based on the rece

Re: php to python code converter

2009-05-09 Thread Diez B. Roggisch
Dotan Cohen schrieb: I'm almost 100% sure it won't. The code is machine-generated, thus not easy to the human eye, not idiomatic so you don't learn how to write good python through it. You learn how to jump through hoops to code the same way in python that you do in PHP. I meant for single fun

Re: [Python-Dev] .pth files are evil

2009-05-09 Thread Martin v. Löwis
Zooko O'Whielacronx wrote: > .pth files are why I can't easily use GNU stow with easy_install. > If installing a Python package involved writing new files into the > filesystem, but did not require reading, updating, and re-writing any > extant files such as .pth files, then GNU stow would Just Wor

Re: [Python-Dev] PEP 382: little help for stupid people?

2009-05-09 Thread Martin v. Löwis
Chris Withers wrote: > Martin v. Löwis wrote: >>> So this __init__.py can have code in it? >> >> That's the point, yes. >> >>> And base.tar can have other modules and subpackages in it? >> >> Certainly, yes. > > Great, when is the PEP due to land in 2.x? ;-) Most likely, never - it probably will

Re: MacPython 3.0.1 installation problem, no /usr/local/bin/python*

2009-05-09 Thread Benjamin Kaplan
On Sat, May 9, 2009 at 4:30 AM, Raoul Gough wrote: > I just installed MacPython 3.0.1 (woot!) but the installer didn't seem > to do an absolutely complete job. According to the ReadMe.txt, "The > installer puts [...] command-line tools in /usr/local/bin [...]". This > didn't happen - even after th

Re: [Python-Dev] .pth files are evil

2009-05-09 Thread P.J. Eby
At 04:18 PM 5/9/2009 +0200, Martin v. Löwis wrote: Zooko O'Whielacronx wrote: > .pth files are why I can't easily use GNU stow with easy_install. > If installing a Python package involved writing new files into the > filesystem, but did not require reading, updating, and re-writing any > extant

Re: [Python-Dev] .pth files are evil

2009-05-09 Thread Martin v. Löwis
>> If you always use --single-version-externally-managed with easy_install, >> it will stop editing .pth files on installation. > > It's --multi-version (-m) that does that. > --single-version-externally-managed is a "setup.py install" option. > > Both have the effect of not editing .pth files,

Re: Wrapping comments

2009-05-09 Thread Ben Finney
Tobias Weber writes: > Or are there editors that can do a "soft hard wrap" while keeping > indentation and #comment markers intact? Yes. Both Emacs and Vim will do exactly this when re-wrapping a paragraph of commented lines, provided they have support for the language's comment syntax (which,

Thread locking question.

2009-05-09 Thread grocery_stocker
The following code gets data from 5 different websites at the "same time". #!/usr/bin/python import Queue import threading import urllib2 import time hosts = ["http://yahoo.com";, "http://google.com";, "http://amazon.com";, "http://ibm.com";, "http://apple.com";] queue = Queue.Queue()

Re: unicode bit me

2009-05-09 Thread J. Clifford Dyer
You're still not asking questions in a way that we can answer them. Define "Doesn't work." Define "a". On Sat, 2009-05-09 at 00:04 -0700, anuraguni...@yahoo.com wrote: > also not sure why (python 2.5) > print a # works > print unicode(a) # works > print [a] # works > print unicode([a]) # doesn'

need help with properties

2009-05-09 Thread Esmail
Hi, I am just reading about properties in Python. I am thinking of this as an indirection mechanism, is that wrong? If so, how come the getter/setters aren't called when I use properties instead of the functions directly? What am I missing here? I have a feeling I am overlooking something simple

Re: [Python-Dev] .pth files are evil

2009-05-09 Thread P.J. Eby
At 04:42 PM 5/9/2009 +0200, Martin v. Löwis wrote: >> If you always use --single-version-externally-managed with easy_install, >> it will stop editing .pth files on installation. > > It's --multi-version (-m) that does that. > --single-version-externally-managed is a "setup.py install" option. >

Re: Thread locking question.

2009-05-09 Thread Piet van Oostrum
> grocery_stocker (gs) wrote: >gs> The following code gets data from 5 different websites at the "same >gs> time". >gs> #!/usr/bin/python >gs> import Queue >gs> import threading >gs> import urllib2 >gs> import time >gs> hosts = ["http://yahoo.com";, "http://google.com";, "http://amazon.com

Re: Wrapping comments

2009-05-09 Thread Steven D'Aprano
On Sat, 09 May 2009 07:19:45 -0700, Scott David Daniels wrote: > > So what if you hard wrap code but let comments and docstrings > > soft-wrap? > > You apparently have caught the soft-/hard- disease spread by several > software retailers. There are no such characters as "hard break," "soft > bre

Re: unicode bit me

2009-05-09 Thread anuraguni...@yahoo.com
Sorry being unclear again, hmm I am becoming an expert in it. I pasted that code as continuation of my old code at start i.e class A(object): def __unicode__(self): return u"©au" def __repr__(self): return unicode(self).encode("utf-8") __str__ = __repr__ doesn't

Re: slice iterator?

2009-05-09 Thread ryles
On May 8, 11:17 pm, Ross wrote: > I have a really long list that I would like segmented into smaller > lists. Let's say I had a list a = [1,2,3,4,5,6,7,8,9,10,11,12] and I > wanted to split it into groups of 2 or groups of 3 or 4, etc. Is there > a way to do this without explicitly defining new li

Re: need help with properties

2009-05-09 Thread Scott David Daniels
Esmail wrote: I am just reading about properties in Python. I am thinking of this as an indirection mechanism, is that wrong? If so, how come the getter/setters aren't called when I use properties instead of the functions directly? Because you weren't actually using them. You were writing:

Anyone familiar with python bittorrent?

2009-05-09 Thread Basil Brush
I was just looking at the bittorrent python code as I'm thinking of combining it with some other stuff to expand it. Am I right in thinking that bittorrent launches a new python process for every torrent you download? That seems not good for what I want to do; if I've got 500 torrents I want to que

Re: need help with properties

2009-05-09 Thread Steven D'Aprano
On Sat, 09 May 2009 11:30:02 -0400, Esmail wrote: > Hi, > > I am just reading about properties in Python. I am thinking of this as > an indirection mechanism, is that wrong? If so, how come the > getter/setters aren't called when I use properties instead of the > functions directly? > > What am

Re: Thread locking question.

2009-05-09 Thread grocery_stocker
On May 9, 8:36 am, Piet van Oostrum wrote: > > grocery_stocker (gs) wrote: > >gs> The following code gets data from 5 different websites at the "same > >gs> time". > >gs> #!/usr/bin/python > >gs> import Queue > >gs> import threading > >gs> import urllib2 > >gs> import time > >gs> hosts = ["ht

Re: need help with properties

2009-05-09 Thread Esmail
hi Scott, Scott David Daniels wrote: Esmail wrote: I am just reading about properties in Python. I am thinking of this as an indirection mechanism, is that wrong? If so, how come the getter/setters aren't called when I use properties instead of the functions directly? Because you weren't actua

Re: ISO exemplary Python scripts

2009-05-09 Thread kj
In <802a051qoqmpnih0j2su9hhriqumagu...@4ax.com> Tim Roberts writes: >kj wrote: >> >>I'm learning python, for the umpteenth time. This time I decided >>to start out by writing Python scripts for everyday tasks. Most >>of these scripts are meant to be used only once or twice, but a >>few of the

Re: need help with properties

2009-05-09 Thread Esmail
Steven D'Aprano wrote: All you've done in this second block is define a new object called "size" and assign the tuple (3, 7) to it. oops .. yes, you are right, and I am embarrassed... [Aside: you might not be aware that it is commas that make tuples, not brackets. The brackets are for grou

Re: Thread locking question.

2009-05-09 Thread Pascal Chambon
grocery_stocker a écrit : On May 9, 8:36 am, Piet van Oostrum wrote: grocery_stocker (gs) wrote: gs> The following code gets data from 5 different websites at the "same gs> time". gs> #!/usr/bin/python gs> import Queue gs> import threading gs> import urllib2 gs> import time

Get multiprocessing.Queue to do priorities

2009-05-09 Thread uuid
Hello, I was wondering whether there was a way to make multiprocessing.Queue behave in a priority queue-like fashion. Subclassing with heappush and heappop for put and get doesn't work the old way (multiprocessing.Queue seems to use different data structures than Queue.Queue?) Could one creat

Frozen executable to load external python code at the runtime

2009-05-09 Thread Gnep
Hi, all, Just curious whether I can do the following: 1. My python source code will dynamically load and run external python scripts; 2. I need to compile the source code to the executable using freeze; 3. Is the executable still able to load&run the scripts? 4. If cannot, is it possible to fre

Re: heapq.merge with key=

2009-05-09 Thread Scott David Daniels
Peter Otten wrote: Kevin D. Smith wrote: On 2009-05-07 23:48:43 -0500, Chris Rebert said: On Thu, May 7, 2009 at 2:23 PM, Kevin D. Smith wrote: I need the behavior of heapq.merge to merge a bunch of results from a database I would prefer to do this with generators I need the key

Re: Get multiprocessing.Queue to do priorities

2009-05-09 Thread uuid
I just read up and it seems that no matter the approach, it's futile to use multiprocessing.Queue, since there is a bug that prevents true FIFO. (http://bugs.python.org/issue4999) Any recommendation on an alternate way to build a priority queue to use with a "one producer, many consumers" type

Re: unicode bit me

2009-05-09 Thread Scott David Daniels
ru...@yahoo.com wrote: On May 9, 10:08 am, Steven D'Aprano wrote: On Sat, 09 May 2009 08:37:59 -0700, anuraguni...@yahoo.com wrote: Sorry being unclear again, hmm I am becoming an expert in it. I pasted that code as continuation of my old code at start i.e class A(object): def __unicode_

Re: I'm intrigued that Python has some functional constructions in the language.

2009-05-09 Thread namekuseijin
Lawrence D'Oliveiro wrote: In message <692b7ae8-0c5b-498a- a012-51bda980f...@s28g2000vbp.googlegroups.com>, namekuseijin wrote: On May 8, 6:48 pm, Lawrence D'Oliveiro wrote: In message , namekuseijin wrote: Carl Banks escreveu: 2. However, functional programming is cryptic at some level no

Re: mod_python and xml.dom.minidom

2009-05-09 Thread Paul Boddie
On 9 Mai, 01:36, dpapathanasiou wrote: > > Apache's configure utility (I'm using httpd version 2.2.11) doesn't > explicitly describe an expat library option. > > Also, if libexpat is version 1.95.2, wouldn't I have to get version > 2.0 to be compatible with pyexpat? The aim would be to persuade A

Re: I'm intrigued that Python has some functional constructions in the language.

2009-05-09 Thread namekuseijin
Carl Banks wrote: On May 8, 7:19 pm, namekuseijin wrote: On May 8, 10:13 pm, Carl Banks wrote: In Haskell, Lisp and other functional programming languages, any extra syntax gets converted into the core lambda constructs. So? The user still uses that syntax, so how can you claim it doesn't m

Re: need help with properties

2009-05-09 Thread Scott David Daniels
Esmail wrote: Just curious, is there a way to pass more than one arg to a setter, or do we always have use some sort of unpacking at the other end? Think about the source for a setter. it comes from: .name = You could add optional args, but the option would never be taken. If you never in

Re: need help with properties

2009-05-09 Thread Esmail
Scott David Daniels wrote: <... good stuff ... > the Python 3.X world is wisely losing the unpacking in parameter passing trick. Thanks Scott, useful information, Esmail -- http://mail.python.org/mailman/listinfo/python-list

Re: slice iterator?

2009-05-09 Thread Emile van Sebille
On 5/8/2009 8:17 PM Ross said... I have a really long list that I would like segmented into smaller lists. Let's say I had a list a = [1,2,3,4,5,6,7,8,9,10,11,12] and I wanted to split it into groups of 2 or groups of 3 or 4, etc. Is there a way to do this without explicitly defining new lists?

Re: unicode bit me

2009-05-09 Thread Mark Tolonen
wrote in message news:994147fb-cdf3-4c55-8dc5-62d769b12...@u9g2000pre.googlegroups.com... Sorry being unclear again, hmm I am becoming an expert in it. I pasted that code as continuation of my old code at start i.e class A(object): def __unicode__(self): return u"©au" def _

Re: I'm intrigued that Python has some functional constructions in the language.

2009-05-09 Thread Steven D'Aprano
On Sat, 09 May 2009 14:57:24 -0300, namekuseijin wrote: > I'm saying syntax is nothing special. They are user-defined, as > functions. And it all gets converted into functions. Functions matter, > syntax is irrelevant because you can do away with it. How do you call functions without syntax? B

Re: [Python-Dev] .pth files are evil

2009-05-09 Thread Дамјан Георгиевски
> Ah, ok. Is there also an easy_install invocation that unpacks the zip > file into some location of sys.path (which then wouldn't require > editing sys.path)? You have pip that does that :) -- дамјан ( http://softver.org.mk/damjan/ ) ... knowledge is exactly like power - something to be dist

Re: I'm intrigued that Python has some functional constructions in the language.

2009-05-09 Thread Paul Rubin
Steven D'Aprano writes: > I think your point is wrong. Without syntax, there can be no written > communication. In Haskell, f.g is not the same as f+g -- the difference > is one of syntax. In Haskell, (+) and (.) are both functions. (+) takes two numbers as arguments and returns their sum. (.

Re: unicode bit me

2009-05-09 Thread Piet van Oostrum
> "Mark Tolonen" (MT) wrote: >MT> wrote in message >MT> news:994147fb-cdf3-4c55-8dc5-62d769b12...@u9g2000pre.googlegroups.com... >>> Sorry being unclear again, hmm I am becoming an expert in it. >>> >>> I pasted that code as continuation of my old code at start >>> i.e >>> class A(object):

Re: Thread locking question.

2009-05-09 Thread Piet van Oostrum
> grocery_stocker (gs) wrote: [snip] >gs> Maybe I'm being a bit daft, but what prevents the data from www.yahoo.com >gs> from being mixed up with the data from www.google.com? Doesn't using >gs> queue() prevent the data from being mixed up? Nothing in your script prevents the data from gett

Re: IIR filter conversion routines for Python?

2009-05-09 Thread Robert Kern
On 2009-05-09 06:54, wzab wrote: Unfortunately the Matlab scripts that are floating around the net do not contain the license information. (e.g. takasila.coe.psu.ac.th/~s4810685/DSP/proakis/PWS_DSP/dir2cas.m ) So I don't know if it sufficient to consider the "public domain"... No! The opposit

Re: IIR filter conversion routines for Python?

2009-05-09 Thread Robert Kern
On 2009-05-09 08:34, wzab wrote: In fact I have almost finished the simple dir2cas.py converter. I'll post the source as soon, as it is ready. OK. So here it is as public domain code. Any hints and suggestions of improvements are appreciated. http://groups.google.com/group/alt.sources/browse_t

Re: Wrapping comments

2009-05-09 Thread Arnaud Delobelle
Tobias Weber writes: > In article , > Scott David Daniels wrote: > >> At least vim and emacs can do so. > > Just tried Aquamacs. Using the defaults it correctly re-wraped > docstrings using newlines when inserting, but not when removing words. > So even with the prime editor hard wrap seems, f

Re: unicode bit me

2009-05-09 Thread Mark Tolonen
"Piet van Oostrum" wrote in message news:m263gagjjl@cs.uu.nl... "Mark Tolonen" (MT) wrote: MT> wrote in message MT> news:994147fb-cdf3-4c55-8dc5-62d769b12...@u9g2000pre.googlegroups.com... Sorry being unclear again, hmm I am becoming an expert in it. I pasted that code as continuat

Re: Why there is a parameter named "self" for classmethod function?

2009-05-09 Thread Aaron Brady
On May 8, 7:52 pm, Steven D'Aprano wrote: > On Thu, 07 May 2009 04:27:15 -0700, Aaron Brady wrote: > >> Can be, but if there's reason enough to keep it with a class, there's > >> no reason not to. > > > That's a bit of hyperbole; the usual reasons such as code bloat, > > namespace bloat, maintaina

pyMPI error on mpi.barrier

2009-05-09 Thread Dina Ali
Hello there I am trying to paralleize GA code using pyMPI. part of the code and and the error message is as below. i write the new positions in a file by root (which is mpi.rank = 0) then other processes are suppose to wait until the written in the file finishes to start evaluating the objective.

pyMPI error on mpi.barrier

2009-05-09 Thread Dina Ali
Hello there I am trying to paralleize GA code using pyMPI. part of the code and and the error message is as below. i write the new positions in a file by root (which is mpi.rank = 0) then other processes are suppose to wait until the written in the file finishes to start evaluating the objective.

pyMPI error on mpi.barrier

2009-05-09 Thread Dina Ali
Hello there I am trying to paralleize GA code using pyMPI. part of the code and and the error message is as below. i write the new positions in a file by root (which is mpi.rank = 0) then other processes are suppose to wait until the written in the file finishes to start evaluating the objective.

Re: Wrapping comments

2009-05-09 Thread Ben Finney
Tobias Weber writes: > In article <87zldmcod8@benfinney.id.au>, > Ben Finney wrote: > > > Yes. Both Emacs and Vim will do exactly this when re-wrapping a > > Thought so. And editors without a learning curve? A text editor that will be useful in all of your computing is something worth le

Re: Wrapping comments

2009-05-09 Thread Lawrence D'Oliveiro
In message , Tobias Weber wrote: > the guideline (PEP 8) is hard wrap to 7x characters. Nowadays I set my maximum line lengths, and the widths of my terminal windows to 100 characters. And I'm wondering whether or not to go wider still. After all, the screens can take it. -- http://mail.pytho

Re: About twisted.mail.smtp.SMTPDeliveryError

2009-05-09 Thread Aahz
In article <8bb91b91-c00d-48d1-8b64-6f4765754...@d19g2000prh.googlegroups.com>, gganesh wrote: > >MAILSERVER = 'mail.xxx.com' >done = sendmail(MAILSERVER, FROM, listTo, >MSGBODY ,senderDomainName=None, port=25) > >"Failure: twisted.mail.smtp.SMTPDeliveryError: 554 No recipients >accepted" >and >"

Re: Wrapping comments

2009-05-09 Thread Scott David Daniels
Lawrence D'Oliveiro wrote: In message , Tobias Weber wrote: the guideline (PEP 8) is hard wrap to 7x characters. Nowadays I set my maximum line lengths, and the widths of my terminal windows to 100 characters. And I'm wondering whether or not to go wider still. After all, the screens can t

Re: I'm intrigued that Python has some functional constructions in the language.

2009-05-09 Thread Steven D'Aprano
On Sat, 09 May 2009 12:08:49 -0700, Paul Rubin wrote: > Steven D'Aprano writes: >> I think your point is wrong. Without syntax, there can be no written >> communication. In Haskell, f.g is not the same as f+g -- the difference >> is one of syntax. > > In Haskell, (+) and (.) are both functions.

Re: I'm intrigued that Python has some functional constructions in the language.

2009-05-09 Thread namekuseijin
Steven D'Aprano wrote: On Sat, 09 May 2009 14:57:24 -0300, namekuseijin wrote: I'm saying syntax is nothing special. They are user-defined, as functions. And it all gets converted into functions. Functions matter, syntax is irrelevant because you can do away with it. How do you call functi

Re: I'm intrigued that Python has some functional constructions in the language.

2009-05-09 Thread Carl Banks
On May 9, 10:57 am, namekuseijin wrote: > Carl Banks wrote: > > On May 8, 7:19 pm, namekuseijin wrote: > >> On May 8, 10:13 pm, Carl Banks wrote: > >> In Haskell, Lisp and other functional programming languages, any extra > >> syntax gets converted into the core lambda constructs. > > > So?  The

Re: Wrapping comments

2009-05-09 Thread Lawrence D'Oliveiro
In message , Scott David Daniels wrote: > Lawrence D'Oliveiro wrote: > >> In message , Tobias Weber >> wrote: >> >>> the guideline (PEP 8) is hard wrap to 7x characters. >> >> Nowadays I set my maximum line lengths, and the widths of my terminal >> windows to 100 characters. And I'm wondering w

Re: Wrapping comments

2009-05-09 Thread Lawrence D'Oliveiro
In message , Lawrence D'Oliveiro wrote: > In message , Scott David Daniels > wrote: > >> Lawrence D'Oliveiro wrote: >> >>> In message , Tobias Weber >>> wrote: >>> the guideline (PEP 8) is hard wrap to 7x characters. >>> >>> Nowadays I set my maximum line lengths, and the widths of my term

Re: I'm intrigued that Python has some functional constructions in the language.

2009-05-09 Thread Paul Rubin
Steven D'Aprano writes: > > So it's really true you can get rid of almost all Haskell expression > > syntax. > > And what you've got left is syntax. Without syntax, how can you tell the > difference between a meaningful character string and a jumble of random > gibberish? Without syntax, how ca

OT (humor): 'import antigravity' in action!

2009-05-09 Thread Shawn Milochik
I know you've probably all seen this 50 times, but just in case: http://xkcd.com/353/ And here's the result: http://icanhascheezburger.com/2009/05/06/funny-pictures-behavior-20/ -- http://mail.python.org/mailman/listinfo/python-list

Pythonic way to normalize vertical whitespace

2009-05-09 Thread python
I'm looking for suggestions on technique (not necessarily code) about the most pythonic way to normalize vertical whitespace in blocks of text so that there is never more than 1 blank line between paragraphs. Our source text has newlines normalized to single newlines (\n vs. combinations of \r and

confused with subprocess.Popen

2009-05-09 Thread Soumen banerjee
Hello, for a certain app, i used to use a command: os.system("soundwrapper espeak -f line.txt") now, if i wanted to kill espeak, i would have to run: os.system("killall espeak") since the subprocess module allows sending SIGKILL to the process, i decided to switch to using it. However i cant pass t

SOAPpy(10060, 'Operation timed out')

2009-05-09 Thread Zhang, Ning
Hi all I am working for a energy company, we currently want to use api to load data into the database. I am new for soappy package. I have done a bit research on http://www.ibm.com/developerworks/webse ... #resources

Re: Decorating methods - where do my arguments go?

2009-05-09 Thread MRAB
Mikael Olofsson wrote: Hi all! I have long tried to avoid decorators, but now I find myself in a situation where I think they can help. I seem to be able to decorate functions, but I fail miserably when trying to decorate methods. The information I have been able to find on-line focuses on de

Re: xml in python

2009-05-09 Thread Shawn Milochik
On Fri, May 8, 2009 at 3:46 AM, Rustom Mody wrote: > Can someone give me a heads up on xml parsing in python? > The context is that I want to write a simple docbook to text converter. > DOM is alright -- dont want to break my head with SAX just for performance > when my documents are not likely to

Nimrod programming language

2009-05-09 Thread Andreas Rumpf
Dear Python-users, I invented a new programming language called "Nimrod" that combines Python's readability with C's performance. Please check it out: http://force7.de/nimrod/ Any feedback is appreciated. Regards, Andreas Rumpf __ GRATIS für a

Re: import overwrites __name__

2009-05-09 Thread MRAB
Marco wrote: Hi, There happened something that I do not understand. Actually I don't even know how it can be possible. I import a module and then the name space of the importing module seems do be overwritten. my_name = __name__ print my_name print len(dir()) from x import y as z print __n

Re: I'm intrigued that Python has some functional constructions in the language.

2009-05-09 Thread Stephen Hansen
> Python also has higher-order functions like that, but their use is > disfavored in certain circles. With Python 3, there has actually been > movement towards removing them from the language. ... Buh? Reduce was moved to functools, map and filter weren't touched; there was some discussion befor

Re: mod_python and xml.dom.minidom

2009-05-09 Thread Stephen Hansen
> > My only advice is, don't use mod_python. The project is dead, you > should use mod_wsgi instead: http://code.google.com/p/modwsgi/ > To echo what Daniel said, mod_wsgi is really the way to go. It might still not work in "embedded" mode where like mod_python the Python interpreter is in the Ap

Re: How do I test the integrity of a Python installation in Debian and Ubuntu

2009-05-09 Thread Geoff Gardiner
Aahz wrote: > How important is the apt-get requirement? That's a significant point, thank you. Two parts to the response: a) I don't feel that I am sufficiently expert to launch into compilation of Python if I can avoid it. b) I hope that I can put all platform risk into the lap of the hosting

Re: Thread locking question.

2009-05-09 Thread MRAB
Piet van Oostrum wrote: grocery_stocker (gs) wrote: gs> The following code gets data from 5 different websites at the "same gs> time". [snip] gs> start = time.time() gs> def main(): gs> for i in range(5): gs> t = MyUrl(queue) gs> t.setDaemon(True) gs> t.star

"Beginning Python Visualization" by Shai Vaingast

2009-05-09 Thread UrsusMaximus
I just read this book and liked it. Here is a review: Sometimes a picture is worth a thousand words. "Beginning Python Visualization: Creating Visual Transformation Scripts", published in February 2009 by Apress, shows how Python and its related tools can be used to easily and effectively turn raw

Is there a better way to chose a slice of a list?

2009-05-09 Thread walterbyrd
This works, but it seems like there should be a better way. -- week = ['sun','mon','tue','wed','thu','fri','sat'] for day in week[week.index('tue'):week.index('fri')]: print day --- -- http://mail.python.org/mailman/listinfo/python-list

Re: Code works fine except...

2009-05-09 Thread Arnaud Delobelle
John Yeung writes: > On May 5, 11:37 pm, Ross wrote: > >> On May 5, 10:33 am, MRAB wrote: >> >> > Here's my approach (incomplete): >> >> FYI... I was testing your code further and discovered a strange >> outcome... when there are 16 people for 7 courts, every 7th >> round your code produces 4 b

Re: Get multiprocessing.Queue to do priorities

2009-05-09 Thread Scott David Daniels
uuid wrote: Any recommendation on an alternate way to build a priority queue to use with a "one producer, many consumers" type multiprocessing setup would be welcomed! ? "one producer, many consumers" ? What would the priority queue do? Choose a consumer? --Scott David Daniels scott.dani...@

Re: Get multiprocessing.Queue to do priorities

2009-05-09 Thread uuid
Scott David Daniels wrote: > > ? "one producer, many consumers" ? > What would the priority queue do? Choose a consumer? Sorry, I should have provided a little more detail. There is one producer thread, reading urls from multiple files and external input. These urls have a certain priority, and

Re: Get multiprocessing.Queue to do priorities

2009-05-09 Thread Scott David Daniels
uuid wrote: Scott David Daniels wrote: ? "one producer, many consumers" ? What would the priority queue do? Choose a consumer? Sorry, I should have provided a little more detail. There is one producer thread, reading urls from multiple files and external input. These urls have a certain prio

Re: Get multiprocessing.Queue to do priorities

2009-05-09 Thread uuid
The Queue module, apparently, is thread safe, but *not* process safe. If you try to use an ordinary Queue, it appears inaccessible to the worker process. (Which, after all, is quite logical, since methods for moving items between the threads of the same process are quite different from inter-pr

Re: Is there a better way to chose a slice of a list?

2009-05-09 Thread pruebauno
On May 8, 3:03 pm, walterbyrd wrote: > This works, but it seems like there should be a better way. > > -- > week = ['sun','mon','tue','wed','thu','fri','sat'] > for day in week[week.index('tue'):week.index('fri')]: >    print day > --- Depending on the context this style m

Re: Is there a better way to chose a slice of a list?

2009-05-09 Thread John Yeung
On May 8, 3:03 pm, walterbyrd wrote: > This works, but it seems like there should be a better way. > > -- > week = ['sun','mon','tue','wed','thu','fri','sat'] > for day in week[week.index('tue'):week.index('fri')]: >    print day > --- I think you should provide much more

Re: SQL and CSV

2009-05-09 Thread Lawrence D'Oliveiro
In message , andrew cooke wrote: > even if you're not open to injection attacks, you're still less likely to > get escaping correct than a puprose written, widely used library. Escaping isn't really that hard to do. For example, the rules for MySQL literals are clearly spelled out here

Re: SimpleXMLRPCServer and creating a new object on for each new client request.

2009-05-09 Thread google
On May 8, 1:17 am, Piet van Oostrum wrote: > > Jelle Smet (JS) wrote: > > One more thing: > > >JS> I start python interactively: > > import xmlrpclib > > session1=xmlrpclib.ServerProxy('http://localhost:8000') > > session2=xmlrpclib.ServerProxy('http://localhost:8000') > > pri

Re: SimpleXMLRPCServer and creating a new object on for each new client request.

2009-05-09 Thread Piet van Oostrum
> goo...@smetj.net (g) wrote: >g> Well, I think Martin's example will suit my needs. >g> Thanks for the explanation! His client code is unnecessarily complicated with 3 session variables. The following code does the same: SESSION = xmlrpclib.ServerProxy(URL_PORT) print(SESSION.show_

  1   2   >