Re: Config files with different types

2009-07-03 Thread Javier Collado
Hello, Have you considered using something that is already developed? You could take a look at this presentation for an overview of what's available: http://us.pycon.org/2009/conference/schedule/event/5/ Anyway, let me explain that, since I "discovered" it, my favourite format for configuration

Re: logging of strings with broken encoding

2009-07-03 Thread Thomas Guettler
Stefan Behnel schrieb: > Thomas Guettler wrote: >> My quick fix is this: >> >> class MyFormatter(logging.Formatter): >> def format(self, record): >> msg=logging.Formatter.format(self, record) >> if isinstance(msg, str): >> msg=msg.decode('utf8', 'replace') >>

Re: Sequence splitting

2009-07-03 Thread Lie Ryan
Brad wrote: > On Jul 2, 9:40 pm, "Pablo Torres N." wrote: >> If it is speed that we are after, it's my understanding that map and >> filter are faster than iterating with the for statement (and also >> faster than list comprehensions). So here is a rewrite: >> >> def split(seq, func=bool): >>

Re: logging of strings with broken encoding

2009-07-03 Thread Lie Ryan
Thomas Guettler wrote: > Stefan Behnel schrieb: >> Thomas Guettler wrote: >>> My quick fix is this: >>> >>> class MyFormatter(logging.Formatter): >>> def format(self, record): >>> msg=logging.Formatter.format(self, record) >>> if isinstance(msg, str): >>> msg=msg.dec

Re: question of style

2009-07-03 Thread Paul Rubin
Lie Ryan writes: > I guess in python, None as the missing datum idiom is still quite prevalent: Well, sometimes there is no way around it, but: > def cat_list(a=None, b=None): > # poor man's list concatenation > if a is None and b is None: return [] > if a is None: return b > if

use python to edit pdf document

2009-07-03 Thread nillgump
hi all. I are looking for some packages which use python to edit pdf format docutment. when I searched the internet,I found the paper " Using Python as PDF Editing and Processing Framework" which is at: *http://www.python.org/workshops/2002-02/papers/17/ index.htm* this paper is

Re: Sequence splitting

2009-07-03 Thread Lie Ryan
Rickard Lindberg wrote: >> I tried posting on python-ideas and received a "You are not allowed to >> post to this mailing list" reply. Perhaps because I am posting through >> Google groups? Or maybe one must be an approved member to post? > > If you got an "awaiting moderator approval" message you

Re: use python to edit pdf document

2009-07-03 Thread Chris Rebert
On Fri, Jul 3, 2009 at 12:31 AM, nillgump wrote: > hi all. > I  are looking for some packages which use python to edit pdf format > docutment. > when I searched the internet,I found  the > paper  " Using Python as PDF Editing and Processing Framework"  which > is at: > *http://www.python.or

Re: question of style

2009-07-03 Thread Steven D'Aprano
On Thu, 02 Jul 2009 21:56:40 -0700, Paul Rubin wrote: >> Well I wouldn't know, I've been fortunate enough to program mostly in >> python for over half a decade now and None and 0 are as close as I've >> gotten to NULL in a long time. > > Right, and how many times have you had to debug > >Att

Re: Sequence splitting

2009-07-03 Thread Steven D'Aprano
On Thu, 02 Jul 2009 22:10:14 -0500, Pablo Torres N. wrote: > This sounds like it belongs to the python-ideas list. I suggest posting > there for better feedback, since the core developers check that list > more often than this one. If you post to python-ideas, you'll probably be told to gather f

Re: Sequence splitting

2009-07-03 Thread Paul Rubin
Steven D'Aprano writes: > I've never needed such a split function, and I don't like the name, and > the functionality isn't general enough. I'd prefer something which splits > the input sequence into as many sublists as necessary, according to the > output of the key function. Something like it

Re: Adding an object to the global namespace through " f_globals" is that allowed ?

2009-07-03 Thread Stef Mientki
ryles wrote: On Jul 2, 1:25 am, Terry Reedy wrote: The next statement works, but I'm not sure if it will have any dramatical side effects, other than overruling a possible object with the name A def some_function ( ...) : A = object ( ...) s

Re: question of style

2009-07-03 Thread Lie Ryan
Paul Rubin wrote: > Lie Ryan writes: >> I guess in python, None as the missing datum idiom is still quite prevalent: > > Well, sometimes there is no way around it, but: > >> def cat_list(a=None, b=None): >> # poor man's list concatenation >> if a is None and b is None: return [] >> i

Re: No trees in the stdlib?

2009-07-03 Thread Lawrence D'Oliveiro
In message , João Valverde wrote: > Lawrence D'Oliveiro wrote: > >> In message , João >> Valverde wrote: >> >>> Simple example usage case: Insert string into data structure in sorted >>> order if it doesn't exist, else retrieve it. >> >> the_set = set( ... ) >> >> if str in the_set : >

Re: Sequence splitting

2009-07-03 Thread Chris Rebert
On Thu, Jul 2, 2009 at 11:31 PM, Brad wrote: > On Jul 2, 9:40 pm, "Pablo Torres N." wrote: >> >> If it is speed that we are after, it's my understanding that map and >> filter are faster than iterating with the for statement (and also >> faster than list comprehensions).  So here is a rewrite: >>

Re: XML(JSON?)-over-HTTP: How to define API?

2009-07-03 Thread Diez B. Roggisch
Allen Fowler schrieb: I have an (in-development) python system that needs to shuttle events / requests around over the network to other parts of itself. It will also need to cooperate with a .net application running on yet a different machine. So, naturally I figured some sort of HTTP ev

Re: Adding an object to the global namespace through " f_globals" is that allowed ?

2009-07-03 Thread Chris Rebert
On Fri, Jul 3, 2009 at 1:07 AM, Stef Mientki wrote: > ryles wrote: > > On Jul 2, 1:25 am, Terry Reedy wrote: > > > The next statement works, > but I'm not sure if it will have any dramatical side effects, > other than overruling a possible object with the name A > > > def some_function ( ...) : >

Re: question of style

2009-07-03 Thread Steven D'Aprano
On Thu, 02 Jul 2009 22:14:18 +, Tim Harig wrote: > On 2009-07-02, Paul Rubin wrote: >> Tim Harig writes: >>> If lower is 5 and higher is 3, then it returns 3 because 3 != None in >>> the first if. >> Sorry, the presumption was that lower <= higher, i.e. the comparison >> had already been mad

Re: Why re.match()?

2009-07-03 Thread Steven D'Aprano
On Thu, 02 Jul 2009 11:19:40 +, kj wrote: > I'm sure that it is possible to find cases in which the *current* > implementation of re.search() would be inefficient, but that's because > this implementation is perverse, which, I guess, is ultimately the point > of my original post. Why privileg

Re: how to spawn a process under different user

2009-07-03 Thread Nick Craig-Wood
Gabriel Genellina wrote: > En Thu, 02 Jul 2009 19:27:05 -0300, Tim Harig > escribió: > > On 2009-07-02, sanket wrote: > >>> sanket wrote: > >>> > I am trying to use python's subprocess module to launch a process. > >>> > but in order to do that I have to change the user. > >> I am using python

Re: No trees in the stdlib?

2009-07-03 Thread Paul Rubin
Lawrence D'Oliveiro writes: > >> Want sorted order? > >> sorted(tuple(the_set)) > >> What could be simpler? > > > > Try putting that inside a loop with thousands of iterations and you'll > > see what the problem is. > > You could apply the same argument to anything. E.g. why create a tree >

Re: No trees in the stdlib?

2009-07-03 Thread Steven D'Aprano
On Fri, 03 Jul 2009 20:08:20 +1200, Lawrence D'Oliveiro wrote: > In message , João > Valverde wrote: > >> Lawrence D'Oliveiro wrote: [...] >>> Want sorted order? >>> >>> sorted(tuple(the_set)) >>> >>> What could be simpler? >> >> Try putting that inside a loop with thousands of iterations an

Re: Sequence splitting

2009-07-03 Thread Steven D'Aprano
On Fri, 03 Jul 2009 01:02:56 -0700, Paul Rubin wrote: > Steven D'Aprano writes: >> I've never needed such a split function, and I don't like the name, and >> the functionality isn't general enough. I'd prefer something which >> splits the input sequence into as many sublists as necessary, accordi

Re: PEP368 and pixeliterators

2009-07-03 Thread Steven D'Aprano
On Thu, 02 Jul 2009 10:32:04 +0200, Joachim Strömbergson wrote: > for pixel in rgb_image: > # swap red and blue, and set green to 0 pixel.value = pixel.b, 0, > pixel.r > > > The idea I'm having is that fundamentally the image is made up of a 2D > array of pixels, not rows of pixels. A 2

Re: Sequence splitting

2009-07-03 Thread Paul Rubin
Steven D'Aprano writes: > groupby() works on lists. >>> a = [1,3,4,6,7] >>> from itertools import groupby >>> b = groupby(a, lambda x: x%2==1) # split into even and odd >>> c = list(b) >>> print len(c) 3 >>> d = list(c[1][1])# should be [4,6] >>> print d # oops. [] > The difference between

Re: No trees in the stdlib?

2009-07-03 Thread zooko
Try PyJudy: http://www.dalkescientific.com/Python/PyJudy.html -- http://mail.python.org/mailman/listinfo/python-list

is it possible to write USSD / SMS /SS7 apps in python

2009-07-03 Thread Goksie Aruna
Can someone give me an insight into these? developing ss7 or USSD or SMS apps in python. is there any existing ones in this manner? Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: Sequence splitting

2009-07-03 Thread tsangpo
Just a shorter implementation: from itertools import groupby def split(lst, func): gs = groupby(lst, func) return list(gs[True]), list(gs[False]) "Lie Ryan" дÈëÏûÏ¢ÐÂÎÅ:nfi3m.2341$ze1.1...@news-server.bigpond.net.au... > Brad wrote: >> On Jul 2, 9:40 pm, "Pablo Torres N." wrote: >>>

Re: question of style

2009-07-03 Thread Tim Harig
On 2009-07-03, Steven D'Aprano wrote: > On Thu, 02 Jul 2009 22:14:18 +, Tim Harig wrote: >> On 2009-07-02, Paul Rubin wrote: >>> Tim Harig writes: If lower is 5 and higher is 3, then it returns 3 because 3 != None in the first if. >>> Sorry, the presumption was that lower <= higher

PSP Caching

2009-07-03 Thread Johnson Mpeirwe
Hello All, How do I stop caching of Python Server Pages (or whatever causes changes in a page not to be noticed in a web browser)? I am new to developing web applications in Python and after looking at implementations of PSP like Spyce (which I believed introduces new unnecessary non-PSP synta

Re: is it possible to write USSD / SMS /SS7 apps in python

2009-07-03 Thread Chris Rebert
On Fri, Jul 3, 2009 at 1:55 AM, Goksie Aruna wrote: > Can someone give me an insight into these? > >   developing ss7 or USSD or SMS apps in python. > > is there any existing ones in this manner? Advice for the future: STFW. http://pypi.python.org/pypi?%3Aaction=search&term=sms&submit=search Che

Re: is it possible to write USSD / SMS /SS7 apps in python

2009-07-03 Thread Goke Aruna
On Fri, Jul 3, 2009 at 10:21 AM, Chris Rebert wrote: > On Fri, Jul 3, 2009 at 1:55 AM, Goksie Aruna wrote: > > Can someone give me an insight into these? > > > > developing ss7 or USSD or SMS apps in python. > > > > is there any existing ones in this manner? > > Advice for the future: STFW. > >

Re: Direct interaction with subprocess - the curse of blocking I/O

2009-07-03 Thread yam850
On 1 Jul., 21:30, spillz wrote: > On Jun 29, 3:15 pm, Pascal Chambon wrote: > > I've had real issues with subprocesses recently : from a python script, > > on windows, I wanted to "give control" to a command line utility, i.e > > forward user in put to it and display its output on console. It see

Re: Sequence splitting

2009-07-03 Thread Steven D'Aprano
On Fri, 03 Jul 2009 01:39:27 -0700, Paul Rubin wrote: > Steven D'Aprano writes: >> groupby() works on lists. > a = [1,3,4,6,7] from itertools import groupby b = groupby(a, lambda x: x%2==1) # split into even and odd c = list(b) print len(c) > 3 d = list(c[1][1])

Re: getting rid of —

2009-07-03 Thread Tep
On 3 Jul., 06:40, Simon Forman wrote: > On Jul 2, 4:31 am, Tep wrote: > > > > > > > On 2 Jul., 10:25, Tep wrote: > > > > On 2 Jul., 01:56, MRAB wrote: > > > > > someone wrote: > > > > > Hello, > > > > > > how can I replace '—' sign from string? Or do split at that character? > > > > > Getting u

Re: question of style

2009-07-03 Thread Jean-Michel Pichavant
Simon Forman wrote: Hey I was hoping to get your opinions on a sort of minor stylistic point. These two snippets of code are functionally identical. Which would you use and why? The first one is easier [for me anyway] to read and understand, but Easier for you but not for those who are familia

Is code duplication allowed in this instance?

2009-07-03 Thread Klone
Hi all. I believe in programming there is a common consensus to avoid code duplication, I suppose such terms like 'DRY' are meant to back this idea. Anyways, I'm working on a little project and I'm using TDD (still trying to get a hang of the process) and am trying to test the functionality within

GOZERBOT 0.9.1 BETA2 released

2009-07-03 Thread Bart Thate
GOZERBOT has a new website !! check it out at http://gozerbot.org. This is all in preparation for the 0.9.1 release and the latest GOZERBOT beta has been released as well. Please try this version and let me know how goes. Install is as simple as .. easy_install gozerbot gozerplugs, see README. Th

Re: Sequence splitting

2009-07-03 Thread Paul Moore
2009/7/3 Brad : > Perhaps true, but it would be a nice convenience (for me) as a built- > in written in either Python or C. Although the default case of a bool > function would surely be faster. The chance of getting this accepted as a builtin is essentially zero. To be a builtin, as opposed to be

Re: stringio+tarfile

2009-07-03 Thread superpollo
First problem I see is all those numbers before the lines. That's not valid python. Assuming that was a transcription error not so. i intentionally add linenumbers to facilitare reference to the code, but if it is a nuisance i will not include them anymore. thanks -- http://mail.python.org

Re: pep 8 constants

2009-07-03 Thread Horace Blegg
I've been kinda following this. I have a cousin who is permanently wheel chair bound and doesn't have perfect control of her hands, but still manages to use a computer and interact with society. However, the idea/thought of disabled programmers was new to me/hadn't ever occurred to me. You say tha

Re: Is code duplication allowed in this instance?

2009-07-03 Thread Rickard Lindberg
> Whoever it so happens to verify the > output from the method I have to employ the same algorithm within the > method to do the verification since there is no way I can determine > the output before hand. Can you clarify this scenario a bit? If you are performing black-box testing I don't see wh

Re: stringio+tarfile

2009-07-03 Thread superpollo
thanks to the guys who bothered to answer me even using their chrystal ball ;-) i'll try to be more specific. yes: i want to create a tar file in memory, and add some content from a memory buffer... my platform: $ uname -a Linux fisso 2.4.24 #1 Thu Feb 12 19:49:02 CET 2004 i686 GNU/Linux $ py

Re: Searching equivalent to C++ RAII or deterministic destructors

2009-07-03 Thread Ulrich Eckhardt
Thanks to all that answered, in particular I wasn't aware of the existence of the __del__ function. For completeness' sake, I think I have found another way to not really solve but at least circumvent the problem: weak references. If I understand correctly, those would allow me to pass out handles

Re: stringio+tarfile

2009-07-03 Thread Peter Otten
superpollo wrote: > thanks to the guys who bothered to answer me even using their chrystal > ball ;-) > > i'll try to be more specific. > > yes: i want to create a tar file in memory, and add some content from a > memory buffer... > > my platform: > > $ uname -a > Linux fisso 2.4.24 #1 Thu Feb

Python debugger

2009-07-03 Thread srinivasan srinivas
Hi, Could you suggest some python debuggers? Thanks, Srini Love Cricket? Check out live scores, photos, video highlights and more. Click here http://cricket.yahoo.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Searching equivalent to C++ RAII or deterministic destructors

2009-07-03 Thread Jack Diederich
On Thu, Jul 2, 2009 at 2:36 PM, Carl Banks wrote: > On Jul 2, 3:12 am, Ulrich Eckhardt wrote: >> Bearophile wrote: >> > Ulrich Eckhardt: >> >> a way to automatically release the resource, something >> >> which I would do in the destructor in C++. >> >> > Is this helpful? >> >http://effbot.org/pyre

Re: Sequence splitting

2009-07-03 Thread Pablo Torres N.
On Fri, Jul 3, 2009 at 06:01, Paul Moore wrote: > 2009/7/3 Brad : >> Perhaps true, but it would be a nice convenience (for me) as a built- >> in written in either Python or C. Although the default case of a bool >> function would surely be faster. > > The chance of getting this accepted as a builti

Re: Is code duplication allowed in this instance?

2009-07-03 Thread Francesco Bochicchio
On Jul 3, 12:46 pm, Klone wrote: > Hi all. I believe in programming there is a common consensus to avoid > code duplication, I suppose such terms like 'DRY' are meant to back > this idea. Anyways, I'm working on a little project and I'm using TDD > (still trying to get a hang of the process) and a

Re: Python debugger

2009-07-03 Thread Bruno Desthuilliers
srinivasan srinivas a écrit : Hi, Could you suggest some python debuggers? http://docs.python.org/library/pdb.html#module-pdb HTH -- http://mail.python.org/mailman/listinfo/python-list

Re: Adding an object to the global namespace through " f_globals" is that allowed ?

2009-07-03 Thread Bruno Desthuilliers
Stef Mientki a écrit : hello, I need to add an object's name to the global namespace. The reason for this is to create an environment, where you can add some kind of math environment, where no need for Python knowledge is needed. The next statement works, but I'm not sure if it will have any dr

Re: Is code duplication allowed in this instance?

2009-07-03 Thread Lie Ryan
Klone wrote: > Hi all. I believe in programming there is a common consensus to avoid > code duplication, I suppose such terms like 'DRY' are meant to back > this idea. Anyways, I'm working on a little project and I'm using TDD > (still trying to get a hang of the process) and am trying to test the

Re: Python debugger

2009-07-03 Thread Clovis Fabricio
2009/7/3 srinivasan srinivas : > Could you suggest some python debuggers? Two graphical debugger frontends: http://www.gnu.org/software/emacs/ http://winpdb.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 376

2009-07-03 Thread Tarek Ziadé
Ok here's my proposal for the checksum : - I'll add the "hash_type:" suffix in the record file - install will get a new option to define what hash should be used when writing the RECORD file it will default to SHA1 for 2.7/3.2 - pkgutil, that reads the RECORD files, will pick the right hash fu

Re: Is code duplication allowed in this instance?

2009-07-03 Thread Steven D'Aprano
On Fri, 03 Jul 2009 03:46:32 -0700, Klone wrote: > Hi all. I believe in programming there is a common consensus to avoid > code duplication, I suppose such terms like 'DRY' are meant to back this > idea. Anyways, I'm working on a little project and I'm using TDD (still > trying to get a hang of th

Re: Sequence splitting

2009-07-03 Thread Lie Ryan
tsangpo wrote: > Just a shorter implementation: > > from itertools import groupby > def split(lst, func): > gs = groupby(lst, func) > return list(gs[True]), list(gs[False]) > As you're replying to my post, I assume you meant a shorter implementation my function. But it doesn't do the sam

Re: stringio+tarfile

2009-07-03 Thread Lie Ryan
superpollo wrote: >> First problem I see is all those numbers before the lines. That's not >> valid python. >> >> Assuming that was a transcription error > > not so. i intentionally add linenumbers to facilitare reference to the > code, but if it is a nuisance i will not include them anymore. Th

Re: Why re.match()?

2009-07-03 Thread kj
In <025db0a6$0$20657$c3e8...@news.astraweb.com> Steven D'Aprano writes: >On Thu, 02 Jul 2009 11:19:40 +, kj wrote: >> If the concern is efficiency for such cases, then simply implement >> optional offset and length parameters for re.search(), to specify any >> arbitrary substring to apply t

Re: Why re.match()?

2009-07-03 Thread MRAB
kj wrote: In <025db0a6$0$20657$c3e8...@news.astraweb.com> Steven D'Aprano writes: On Thu, 02 Jul 2009 11:19:40 +, kj wrote: If the concern is efficiency for such cases, then simply implement optional offset and length parameters for re.search(), to specify any arbitrary substring to ap

Clarity vs. code reuse/generality

2009-07-03 Thread kj
I'm will be teaching a programming class to novices, and I've run into a clear conflict between two of the principles I'd like to teach: code clarity vs. code reuse. I'd love your opinion about it. The context is the concept of a binary search. In one of their homeworks, my students will have

Re: pep 8 constants

2009-07-03 Thread Eric S. Johansson
Horace Blegg wrote: > I've been kinda following this. I have a cousin who is permanently wheel > chair bound and doesn't have perfect control of her hands, but still > manages to use a computer and interact with society. However, the > idea/thought of disabled programmers was new to me/hadn't ever

VirtualEnv

2009-07-03 Thread Ronn Ross
I'm attempting to write a bootstrap script for virtualenv. I just want to do a couple of easy_install's after the environment is created. It was fairly easy to create the script, but I can't figure out how to implement it. The documentation was not of much help. Can someone please point me in the r

Re: Why re.match()?

2009-07-03 Thread Aahz
In article , kj wrote: >In <025db0a6$0$20657$c3e8...@news.astraweb.com> Steven D'Aprano > writes: >>On Thu, 02 Jul 2009 11:19:40 +, kj wrote: >>> >>> If the concern is efficiency for such cases, then simply implement >>> optional offset and length parameters for re.search(), to specify any >

Re: Clarity vs. code reuse/generality

2009-07-03 Thread Steven D'Aprano
On Fri, 03 Jul 2009 14:05:08 +, kj wrote: > ... I find that the processing of > abstracting out common logic often results in code that is harder to > read ... Yes. There is often a conflict between increasing abstraction and ease of understanding. [...] > The implementation is still very

Re: Is code duplication allowed in this instance?

2009-07-03 Thread Bearophile
Francesco Bochicchio: > Possibly to prepare the test data set you might need a > different - and already proven - implementation of > the algorithm. Usually a brute force or slow but short algorithm is OK (beside some hard-coded input-output pairs). Sometimes you may use the first implementation

Re: Clarity vs. code reuse/generality

2009-07-03 Thread Alan G Isaac
On 7/3/2009 10:05 AM kj apparently wrote: > The context is the concept of a binary search. In one of their > homeworks, my students will have two occasions to use a binary > search. This seemed like a perfect opportunity to illustrate the > idea of abstracting commonalities of code into a re-usab

Re: Clarity vs. code reuse/generality

2009-07-03 Thread Aahz
In article , kj wrote: > >This seemed straightforward enough, until I realized that, to be >useful to my students in their homework, this _binary_search function >had to handle the case in which the passed function was monotonically >decreasing in the specified interval... > >def _binary_search(l

The TimingAnalyzer -- project to convert from Java to Python

2009-07-03 Thread chewie
Hello, This a project related to the development of an EDA CAD tool program called the TimingAnalyzer. Digital engineers could use this kind of program to analyze and document inteface timing diagrams for IC, ASIC, FPGA, and board level hardware projects. The TimingAnalyzer is licensed as free

Re: Clarity vs. code reuse/generality

2009-07-03 Thread Bearophile
On 3 Lug, 16:05, kj wrote: > I'm will be teaching a programming class to novices, and I've run > into a clear conflict between two of the principles I'd like to > teach: code clarity vs. code reuse. They are both important principles, but clarity is usually more important because short code that

Re: pep 8 constants

2009-07-03 Thread MRAB
Eric S. Johansson wrote: Horace Blegg wrote: I've been kinda following this. I have a cousin who is permanently wheel chair bound and doesn't have perfect control of her hands, but still manages to use a computer and interact with society. However, the idea/thought of disabled programmers was ne

Custom CFLAGS with distutils

2009-07-03 Thread Rocco Rutte
Hi, I've been trying to make distutils build mercurial with custom cflags. The only way this works is to change Makefile because I don't want to put my changed CFLAGS into the environment and I tend to forget to run "make" with a CFLAGS=... option. Google brings up a special "Setup" file which sh

Re: getting rid of —

2009-07-03 Thread Mark Tolonen
"Tep" wrote in message news:46d36544-1ea2-4391-8922-11b8127a2...@o6g2000yqj.googlegroups.com... On 3 Jul., 06:40, Simon Forman wrote: > On Jul 2, 4:31 am, Tep wrote: [snip] > > > > > how can I replace '—' sign from string? Or do split at that > > > > > character? > > > > > Getting unicode

Video shows vigorous Jackson before death???

2009-07-03 Thread Huynh Nhu Thuy
Video shows vigorous Jackson before death??? http://hd-family.blogspot.com/2009/07/video-shows-vigorous-jackson-before.html LOS ANGELES (AFP) – A video released Thursday showed Michael Jackson vigorously practicing a song-and-dance routine days before his death, supporting accounts he had been i

Re: Clarity vs. code reuse/generality

2009-07-03 Thread Bruno Desthuilliers
kj a écrit : I'm will be teaching a programming class to novices, and I've run into a clear conflict between two of the principles I'd like to teach: code clarity vs. code reuse. I'd love your opinion about it. (snip - others already commented on this code) Here's the rub: the code above is

Re: Why re.match()?

2009-07-03 Thread Bruno Desthuilliers
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 pretention to minimalism. -- http://mail.python.org/mailman/listinfo/python-list

Re: Direct interaction with subprocess - the curse of blocking I/O

2009-07-03 Thread Scott David Daniels
yam850 wrote: I made a python method/function for non blocking read from a file object I am happy to see comments. OK, here's a fairly careful set of comments with a few caveats: Does this work on windows? The top comment should say where you know it works. Does this code correctly read

Re: Clarity vs. code reuse/generality

2009-07-03 Thread Jean-Michel Pichavant
kj wrote: I'm will be teaching a programming class to novices, and I've run into a clear conflict between two of the principles I'd like to teach: code clarity vs. code reuse. I'd love your opinion about it. [...] sense = cmp(func(hi), func(lo)) if sense == 0: return None M

Re: Direct interaction with subprocess - the curse of blocking I/O

2009-07-03 Thread yam850
On 3 Jul., 17:43, Scott David Daniels wrote: > yam850 wrote: > > I made a python method/function for nonblockingread from a file > > object I am happy to see comments. > OK, here's a fairly careful set of comments with a few caveats: [snip] valuable comments > --Scott David Daniels > scott.d

Re: Clarity vs. code reuse/generality

2009-07-03 Thread Lie Ryan
kj wrote: > I'm will be teaching a programming class to novices, and I've run > into a clear conflict between two of the principles I'd like to > teach: code clarity vs. code reuse. I'd love your opinion about > it. Sometimes when the decision between clarity and generality becomes too hard; you

Re: Clarity vs. code reuse/generality

2009-07-03 Thread kj
In Alan G Isaac writes: >1. Don't use assertions to test argument values! Out of curiosity, where does this come from? Thanks, kj -- http://mail.python.org/mailman/listinfo/python-list

Re: Clarity vs. code reuse/generality

2009-07-03 Thread kj
In a...@pythoncraft.com (Aahz) writes: >First of all, cmp() is gone in Python 3, unfortunately, so I'd avoid >using it. Good to know. >Second, assuming I understand your code correctly, I'd change >"sense" to "direction" or "order". Thanks, kj -- http://mail.python.org/mailman/listinfo/pyth

Re: getting rid of —

2009-07-03 Thread Tep
On 3 Jul., 16:58, "Mark Tolonen" wrote: > "Tep" wrote in message > > news:46d36544-1ea2-4391-8922-11b8127a2...@o6g2000yqj.googlegroups.com... > > > > > > > On 3 Jul., 06:40, Simon Forman wrote: > > > On Jul 2, 4:31 am, Tep wrote: > [snip] > > > > > > > how can I replace '—' sign from string? Or

Compiling 64 bit python on a mac - cannot compute sizeof (int)

2009-07-03 Thread Keflavich
I'm trying to compile a 64 bit version of python 2.6.2 on my mac (OS X 10.5.7), and am running into a problem during the configure stage. I configure with: ./configure --enable-framework=/Library/Frameworks --enable- universalsdk MACOSX_DEPLOYMENT_TARGET=10.5 --with-universal-archs=all - with-read

Re: Clarity vs. code reuse/generality

2009-07-03 Thread Paul Rubin
kj writes: > sense = cmp(func(hi), func(lo)) > if sense == 0: > return None > target_plus = sense * target + epsilon > target_minus = sense * target - epsilon > ... The code looks confusing to me and in some sense incorrect. Suppose func(hi)==func(lo)==target. In thi

Re: Is Psyco good for Python 2.6.1?

2009-07-03 Thread duncan smith
Russ P. wrote: > I need to speed up some Python code, and I discovered Psyco. However, > the Psyco web page has not been updated since December 2007. Before I > go to the trouble of installing it, does anyone know if it is still > good for Python 2.6.1? Thanks. If you look at http://psyco.sourcefo

Re: Why re.match()?

2009-07-03 Thread Lie Ryan
Steven D'Aprano wrote: > On Thu, 02 Jul 2009 11:19:40 +, kj wrote: > >> I'm sure that it is possible to find cases in which the *current* >> implementation of re.search() would be inefficient, but that's because >> this implementation is perverse, which, I guess, is ultimately the point >> of

Re: Config files with different types

2009-07-03 Thread Zach Hobesh
yaml looks pretty interesting. Also, I wouldn't have to change much, I would still use the same function, and still output a dict. Thanks! -Zach On Thu, Jul 2, 2009 at 11:55 PM, Javier Collado wrote: > Hello, > > Have you considered using something that is already developed? > > You could take

Re: getting rid of —

2009-07-03 Thread MRAB
Tep wrote: On 3 Jul., 16:58, "Mark Tolonen" wrote: "Tep" wrote in message news:46d36544-1ea2-4391-8922-11b8127a2...@o6g2000yqj.googlegroups.com... On 3 Jul., 06:40, Simon Forman wrote: On Jul 2, 4:31 am, Tep wrote: [snip] how can I replace '—' sign from string? Or do split at that

Re: XML(JSON?)-over-HTTP: How to define API?

2009-07-03 Thread Ken Dyck
On Jul 2, 6:17 pm, Allen Fowler wrote: > Since I need to work with other platforms, pickle is out...  what are the > alternatives?  XML? JSON? Don't forget YAML (http://yaml.org). Libraries available for Python and .NET, among others. -Ken -- http://mail.python.org/mailman/listinfo/python-list

Re: Sequence splitting

2009-07-03 Thread Brad
On Jul 3, 12:57 am, Steven D'Aprano wrote: > I've never needed such a split function, and I don't like the name, and > the functionality isn't general enough. I'd prefer something which splits > the input sequence into as many sublists as necessary, according to the > output of the key function.

Re: Sequence splitting

2009-07-03 Thread Paul Rubin
Brad writes: > Maybe this would be difficult to get into the core, but how about this > idea: Rename the current filter function to something like "split" or > "partition" (which I agree may be a better name) and modify it to > return the desired true and false sequences. Then recreate the > exist

Re: Sequence splitting

2009-07-03 Thread Lie Ryan
Brad wrote: > On Jul 3, 12:57 am, Steven D'Aprano cybersource.com.au> wrote: >> I've never needed such a split function, and I don't like the name, and >> the functionality isn't general enough. I'd prefer something which splits >> the input sequence into as many sublists as necessary, according t

PyGtkSourceView / PyScintilla

2009-07-03 Thread fiafulli
Hello to all. I would have need of the recent version (possibly most recent) than one of the two controls in subject. I think that wrapper for scintilla it would be better but creed that the development for pygtk is stopped. therefore I'm more inclined for GtkSourceView (than today it is to the

Re: Sequence splitting

2009-07-03 Thread Scott David Daniels
Steven D'Aprano wrote: I've never needed such a split function, and I don't like the name, and the functionality isn't general enough. I'd prefer something which splits the input sequence into as many sublists as necessary, according to the output of the key function. Something like itertools.g

Re: stringio+tarfile

2009-07-03 Thread superpollo
Peter Otten wrote: gettarinfo() expects a real file, not a file-like object. You have to create your TarInfo manually. ok... which attributes are mandatory, and which optional? I recommend that you have a look into the tarfile module's source code. i will try... but: $ cat /usr/lib/pyt

Re: PSP Caching

2009-07-03 Thread Simon Forman
On Jul 3, 5:18 am, Johnson Mpeirwe wrote: > Hello All, > > How do I stop caching of Python Server Pages (or whatever causes changes > in a page not to be noticed in a web browser)? I am new to developing > web applications in Python and after looking at implementations of PSP > like Spyce (which I

Re: Clarity vs. code reuse/generality

2009-07-03 Thread Alan G Isaac
> In Alan G Isaac > writes: >> 1. Don't use assertions to test argument values! On 7/3/2009 12:19 PM kj apparently wrote: > Out of curiosity, where does this come from? http://docs.python.org/reference/simple_stmts.html#grammar-token-assert_stmt "The current code generator emits no code for

Re: Clarity vs. code reuse/generality

2009-07-03 Thread Steven D'Aprano
On Fri, 03 Jul 2009 16:19:22 +, kj wrote: > In Alan G Isaac > writes: > >>1. Don't use assertions to test argument values! > > Out of curiosity, where does this come from? Assertions are disabled when you run Python with the -O (optimise) flag. If you rely on assertions to verify data, t

Re: Python debugger

2009-07-03 Thread Kee Nethery
It's not free but I like the debugger in Komodo IDE. Lets me simulate a web connection, lets me step through the code and examine the variables as it executes, can be run remotely (have not played with that aspect yet). Does variable inspection of the variables so you can dive into the parts

Reversible Debugging

2009-07-03 Thread Patrick Sabin
Hello, I am interested if there are any python modules, that supports reversible debugging aka stepping backwards. Any links or ideas would be helpful, because I am thinking of implementing something like that. Thanks in advance, Patrick -- http://mail.python.org/mailman/listinfo/python-list

  1   2   >