Re: unicode bit me

2009-05-09 Thread Peter Otten
anuraguni...@yahoo.com wrote: > First of all thanks everybody for putting time with my confusing post > and I apologize for not being clear after so many efforts. > > here is my last try (you are free to ignore my request for free > advice) Finally! This is the first of your posts that makes sen

Re: unicode bit me

2009-05-09 Thread Piet van Oostrum
> "anuraguni...@yahoo.com" (ac) wrote: >ac> and yes replace string by u'\N{COPYRIGHT SIGN}au' >ac> as mentioned earlier non-ascii char may not come correct posted here. That shouldn't be a problem for any decent new agent when there is a proper charset declaration in the headers. -- Piet va

Re: unicode bit me

2009-05-09 Thread Scott David Daniels
anuraguni...@yahoo.com wrote: class A(object): def __unicode__(self): return u"©au" def __repr__(self): return unicode(self).encode("utf-8") __str__ = __repr__ a = A() u1 = unicode(a) u2 = unicode([a]) now I am not using print so that doesn't matter stdout can print u

Re: Nimrod programming language

2009-05-09 Thread kay
On 8 Mai, 17:48, Andreas Rumpf wrote: > 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 > >

Re: confused with subprocess.Popen

2009-05-09 Thread Soumen banerjee
Thanks!, i have found that alternately setting shell=True also works -- http://mail.python.org/mailman/listinfo/python-list

Re: Simple programme - Just want to know whether this is correct way of coding

2009-05-09 Thread Aahz
In article <49f8cb54-f268-46bc-a585-6d116674d...@k19g2000prh.googlegroups.com>, guptha wrote: > >This is my first programme in python ,I need to know whether my code >is in the right path of performance > >I wrote a code using multithreading to send mails Here's the Right Way to do this: install

Re: Simple programme - Just want to know whether this is correct way of coding

2009-05-09 Thread Aahz
In article <7d44d587-15c7-40ea-abe2-6a174f1fd...@q14g2000vbn.googlegroups.com>, namekuseijin wrote: >On May 8, 3:37=A0am, guptha wrote: >> >> The code Works fine ,but I doubt about the performance issue ,My >> intention is to send mails concurrently to large number of mail. >> 1.For every mail i

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

2009-05-09 Thread Ned Deily
In article , Benjamin Kaplan wrote: > 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/bi

Re: unicode bit me

2009-05-09 Thread anuraguni...@yahoo.com
and yes replace string by u'\N{COPYRIGHT SIGN}au' as mentioned earlier non-ascii char may not come correct posted here. On May 10, 9:19 am, "anuraguni...@yahoo.com" wrote: > First of all thanks everybody for putting time with my confusing post > and I apologize for not being clear after so many e

Re: unicode bit me

2009-05-09 Thread anuraguni...@yahoo.com
First of all thanks everybody for putting time with my confusing post and I apologize for not being clear after so many efforts. here is my last try (you are free to ignore my request for free advice) # -*- coding: utf-8 -*- class A(object): def __unicode__(self): return u"©au"

[ANN] pyxser-1.0R --- python xml serialization

2009-05-09 Thread Daniel Molina Wegener
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hello, I'm pleased to announce pyxser-1.0R, a Python-Object to XML serializer and deserializer. This package it's completly written in C and licensed under LGPLv3. The tested Python versions are 2.5.X and 2.7.X. * home page: http://coder.cl/softwa

Re: Wrapping comments

2009-05-09 Thread Grant Edwards
On 2009-05-10, Scott David Daniels wrote: >> 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. >> > But the printers cannot. Printers? The people who p

Re: confused with subprocess.Popen

2009-05-09 Thread Matt Nordhoff
Soumen banerjee wrote: > 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 swit

How can I dynamically insert a base class in a given class

2009-05-09 Thread Дамјан Георгиевски
How can I dynamically insert a base class in a given class? Yeah, I'm writing a class decorator that needs to manipulate the class by inserting another base class in it. Something like: class ReallyBase(object): def someimportantmethod(self): return 'really really' @expose(args) class

Re: unicode bit me

2009-05-09 Thread rurpy
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__(self)

Re: unicode bit me

2009-05-09 Thread Steven D'Aprano
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__(self): > return u"©au" > > def __repr__(se

Re: unicode bit me

2009-05-09 Thread anuraguni...@yahoo.com
sorry for not being specfic and not given all info """ Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52) [GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2 'Linux-2.6.24-19-generic-i686-with-debian-lenny-sid' """ My question has not much to do with stdout because I am able to print unicode so print uni

Re: import overwrites __name__

2009-05-09 Thread Scott David Daniels
Glenn Hutchings wrote: On Fri, 08 May 2009 19:14:52 +0200, Marco wrote: 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 __name__ print len(dir()) print my_name -> __main__

Re: Wrapping comments

2009-05-09 Thread Scott David Daniels
Tobias Weber wrote: the guideline (PEP 8) is hard wrap to 7x characters. The reason given is that soft wrap makes code illegible. 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. T

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_

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: 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: 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: 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: 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: 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
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: 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: 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

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

"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

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

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: 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: 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: 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

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: 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

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

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

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

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

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

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

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: 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: 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: 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 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: 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: 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 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: 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

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: 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

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: 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: 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: 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: 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: 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: 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: [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 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: 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: 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: 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: 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: 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: 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
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: 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: 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: 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

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

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

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

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: 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
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: 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 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

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 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:

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: 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: 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: 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: [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. >

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: 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'

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: 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,

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: [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: 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] 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: [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

  1   2   >