Re: rstrip error python2.4.3 not in 2.5.1?

2008-02-29 Thread dirkheld
> > What is the actual error message [SyntaxError, NameError? etc] that you > clipped? Here it is : I tought that I didn't matter because the deliciousapi worked fine on my mac. Traceback (most recent call last): File "delgraph.py", line 62, in ? url_metadata = d.get_url(site.rstrip()) F

Re: rstrip error python2.4.3 not in 2.5.1?

2008-02-29 Thread Philipp Pagel
dirkheld <[EMAIL PROTECTED]> wrote: > Here it is : I tought that I didn't matter because the deliciousapi > worked fine on my mac. > Traceback (most recent call last): > File "delgraph.py", line 62, in ? > url_metadata = d.get_url(site.rstrip()) > File "deliciousapi.py", line 269, in get_

A python STUN client is ready on Google Code.

2008-02-29 Thread hawk gao
http://code.google.com/p/boogu/ Enjoy it! Hawk -- http://mail.python.org/mailman/listinfo/python-list

Re: Run wxPython app remotely under XWindows

2008-02-29 Thread Bjoern Schliessmann
Sean DiZazzo wrote: > On Feb 28, 3:50 pm, Bjoern Schliessmann > $ ssh some-other-machine >> $ DISPLAY=:0 ./my_app.py > > Should wxPython apps work this way? I think so; at least it works for me. > Do you think it's something with the server? I have no idea. Regards, Björn -- BOFH excuse #3

xsd, data binding. Modern approach?

2008-02-29 Thread Vladimir Kropylev
Hi, What is the most actual approach to python XML data-binding? The answers given by google seam to be rather outdated. Can't believe nothing's changed since 2003. To be concrete, i've faced the following task: I HAVE: - XSD schema (a huge collection of *.xsd files) TODO: - create python classes

Re: feedback requested

2008-02-29 Thread castironpi
On Feb 29, 12:55 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Thu, 28 Feb 2008 08:09:01 -0800 (PST), [EMAIL PROTECTED] declaimed > the following in comp.lang.python: > > > My goal is to return Deadlock from acquire() if its blocking would > > directly create deadlock.  Basic example: > [

Re: xsd, data binding. Modern approach?

2008-02-29 Thread Stefan Behnel
Vladimir Kropylev wrote: > What is the most actual approach to python XML data-binding? > The answers given by google seam to be rather outdated. Can't believe > nothing's changed since 2003. > > To be concrete, i've faced the following task: > I HAVE: > - XSD schema (a huge collection of *.xsd fi

Re: call by reference howto????

2008-02-29 Thread Steve Holden
[EMAIL PROTECTED] wrote: > On Feb 27, 6:02 pm, Tamer Higazi <[EMAIL PROTECTED]> wrote: >> Hi! >> Can somebody of you make me a sample how to define a function based on >> "call by reference" ??? >> >> I am a python newbie and I am not getting smart how to define functions, >> that should modify the

Re: (Newbie) Help with sockets.

2008-02-29 Thread mentaltruckdriver
On Feb 28, 11:22 pm, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2008-02-29, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > > > En Fri, 29 Feb 2008 00:20:26 -0200, <[EMAIL PROTECTED]> escribió: > > >> Hi everyone. I'm fairly new to Python, and even more new to socket > >> programming. I think I'v

Re: Nested module import clutters package namespace?

2008-02-29 Thread Dr. Rüdiger Kupper
Arnaud Delobelle wrote: On Feb 29, 12:16 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: En Thu, 28 Feb 2008 11:00:08 -0200, Dr. Rüdiger Kupper <[EMAIL PROTECTED]> escribió: I'd be grateful for help with a problem of package and module namespaces. The behaviour I observe is unexpected (

Re: is there enough information?

2008-02-29 Thread castironpi
On Feb 29, 12:55 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Thu, 28 Feb 2008 00:54:44 -0800 (PST), [EMAIL PROTECTED] declaimed > the following in comp.lang.python: > > > On Feb 28, 2:30 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > > > "It is time to show your cards or fold" > > > H

Re: call by reference howto????

2008-02-29 Thread castironpi
On Feb 29, 5:56 am, Steve Holden <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > On Feb 27, 6:02 pm, Tamer Higazi <[EMAIL PROTECTED]> wrote: > >> Hi! > >> Can somebody of you make me a sample how to define a function based on > >> "call by reference" ??? > > >> I am a python newbie and I

Re: xsd, data binding. Modern approach?

2008-02-29 Thread Pierre Sangouard
Vladimir Kropylev wrote: > Hi, > > What is the most actual approach to python XML data-binding? > The answers given by google seam to be rather outdated. Can't believe > nothing's changed since 2003. > > To be concrete, i've faced the following task: > I HAVE: > - XSD schema (a huge collection of *

Re: Indentation and optional delimiters

2008-02-29 Thread castironpi
On Feb 28, 3:18 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > | But the default behavior may become the "true" copy, that seems > | simpler for a newbie to grasp. > > To me, it is the opposite.  If I say > gvr = Guido_van_Russum # o

Re: Python's BNF

2008-02-29 Thread MartinRinehart
Gabriel and Steve, Poor globals! They take such a beating and they really don't deserve it. The use of globals was deprecated, if memory serves, during the structured design craze. Using globals is now considered bad practice, but it's considered bad practice for reasons that don't stand close sc

Re: Python app at startup!

2008-02-29 Thread SMALLp
[EMAIL PROTECTED] wrote: > On Feb 28, 5:07 pm, "SMALLp" <[EMAIL PROTECTED]> wrote: >> Hy. I create simple application. Yust an windows and "compile" it with >> py2exe. I add registry value >> reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v >> MyApp /t REG_SZ /d C:\myapp

Re: Python app at startup!

2008-02-29 Thread dave_mikesell
On Feb 29, 7:21 am, SMALLp <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > > Does it do the same thing when you run it with the Python interpreter? > > No. The programm works fine! In interupter and when i "compile" it. My guess is that you're not including something in the .exe that yo

Re: Python app at startup!

2008-02-29 Thread dave_mikesell
On Feb 28, 5:07 pm, "SMALLp" <[EMAIL PROTECTED]> wrote: > Hy. I create simple application. Yust an windows and "compile" it with > py2exe. I add registry value > reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v > MyApp /t REG_SZ /d C:\myapp.exe /f' > > And it wont start.

Re: You have to see this - http://ilaarijs.blogspot.com/ :D

2008-02-29 Thread Steve Holden
[EMAIL PROTECTED] wrote: > You have to see this - http://... :D Sorry. I don't. -- Steve Holden+1 571 484 6266 +1 800 494 3119 Holden Web LLC http://www.holdenweb.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: pySQLite Insert speed

2008-02-29 Thread Steve Holden
[EMAIL PROTECTED] wrote: >> (B) is better than (A). The parameter binding employed in (B) >> is not only faster on many databases, but more secure. > See, for example,http://informixdb.blogspot.com/2007/07/filling-in- > blanks.html > > Thx. The link was helpful, and I think I have read similar th

Re: (Newbie) Help with sockets.

2008-02-29 Thread Grant Edwards
On 2008-02-29, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >> You claim to be writing a telnet server, yet I don't see any >> code that actually implements the telnet protocol. Different >> telnet clients default to different modes, so if you want them >> in a certain mode, you have to put them i

Re: pySQLite Insert speed

2008-02-29 Thread mdboldin
> (B) is better than (A). The parameter binding employed in (B) > is not only faster on many databases, but more secure. See, for example,http://informixdb.blogspot.com/2007/07/filling-in- blanks.html Thx. The link was helpful, and I think I have read similar things before-- that B is faster. So

Re: How to configure Python in Windows

2008-02-29 Thread Steve Holden
[EMAIL PROTECTED] wrote: > Hi Folks, > > I just downloaded precompiled Python for Windows, and it runs. Now I > have got the command line coding. However, I can't run my python > scripts. My python script, foo.py, is located in C:\\\pydir, and I > have set the python interpreter on the directo

why not bisect options?

2008-02-29 Thread Robert Bossy
Hi all, I thought it would be useful if insort and consorts* could accept the same options than list.sort, especially key and cmp. The only catch I can think of is that nothing prevents a crazy developer to insort elements using different options to the same list. I foresee two courses of acti

Re: Indentation and optional delimiters

2008-02-29 Thread Steve Holden
Steve Holden wrote: > [EMAIL PROTECTED] wrote: > [...] > > If you want a computer language to model human thought, then is there >> even such thing as subclassing? > > Kindly try to limit your ramblings to answerable questions. Without keen > insight into the function of the mind that is current

Re: call by reference howto????

2008-02-29 Thread Steve Holden
[EMAIL PROTECTED] wrote: > On Feb 29, 5:56 am, Steve Holden <[EMAIL PROTECTED]> wrote: >> [EMAIL PROTECTED] wrote: >>> On Feb 27, 6:02 pm, Tamer Higazi <[EMAIL PROTECTED]> wrote: Hi! Can somebody of you make me a sample how to define a function based on "call by reference" ??? I

Re: Indentation and optional delimiters

2008-02-29 Thread Steve Holden
[EMAIL PROTECTED] wrote: [...] > If you want a computer language to model human thought, then is there > even such thing as subclassing? Kindly try to limit your ramblings to answerable questions. Without keen insight into the function of the mind that is currently available to the psychologica

Re: joining strings question

2008-02-29 Thread Tim Chase
> I have some data with some categories, titles, subtitles, and a link > to their pdf and I need to join the title and the subtitle for every > file and divide them into their separate groups. > > So the data comes in like this: > > data = ['RULES', 'title','subtitle','pdf', > 'title1','subtitle1

Re: joining strings question

2008-02-29 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > Hi all, > > I have some data with some categories, titles, subtitles, and a link > to their pdf and I need to join the title and the subtitle for every > file and divide them into their separate groups. > > So the data comes in like this: > > data = ['RULES', 'title

Re: joining strings question

2008-02-29 Thread Steve Holden
[EMAIL PROTECTED] wrote: > Hi all, > > I have some data with some categories, titles, subtitles, and a link > to their pdf and I need to join the title and the subtitle for every > file and divide them into their separate groups. > > So the data comes in like this: > > data = ['RULES', 'title','

Problem round-tripping with xml.dom.minidom pretty-printer

2008-02-29 Thread Ben Butler-Cole
Hello I have run into a problem using minidom. I have an HTML file that I want to make occasional, automated changes to (adding new links). My strategy is to parse it with minidom, add a node, pretty print it and write it back to disk. However I find that every time I do a round trip minidom's pr

Re: joining strings question

2008-02-29 Thread patrick . waldo
I tried to make a simple abstraction of my problem, but it's probably better to get down to it. For the funkiness of the data, I'm relatively new to Python and I'm either not processing it well or it's because of BeautifulSoup. Basically, I'm using BeautifulSoup to strip the tables from the Feder

Re: Python's BNF

2008-02-29 Thread Paul McGuire
On Feb 29, 7:21 am, [EMAIL PROTECTED] wrote: > So, as a nod to the anti-global school of thought, I changed 'ofile' > to 'OFILE' so that it would at least look like a global constant. Unfortunately, it's not constant at all. Actually, what you have done is worse. Now you have taken a variable th

joining strings question

2008-02-29 Thread patrick . waldo
Hi all, I have some data with some categories, titles, subtitles, and a link to their pdf and I need to join the title and the subtitle for every file and divide them into their separate groups. So the data comes in like this: data = ['RULES', 'title','subtitle','pdf', 'title1','subtitle1','pdf1

Re: Python's BNF

2008-02-29 Thread Steve Holden
[EMAIL PROTECTED] wrote: > Gabriel and Steve, > > Poor globals! They take such a beating and they really don't deserve > it. > > The use of globals was deprecated, if memory serves, during the > structured design craze. Using globals is now considered bad practice, > but it's considered bad pract

Re: Is crawling the stack "bad"? Why?

2008-02-29 Thread Diez B. Roggisch
> > I will (mostly)... I knew it was bad code and a total hack, I just was > looking for a concise reason as to why. > > I appreciate the comments, guys... thanks! There is another one: crawling the stack is O(n), whilst using thread-local storage is O(1) Diez -- http://mail.python.org/mailm

Re: joining strings question

2008-02-29 Thread Robert Bossy
[EMAIL PROTECTED] wrote: > Hi all, > > I have some data with some categories, titles, subtitles, and a link > to their pdf and I need to join the title and the subtitle for every > file and divide them into their separate groups. > > So the data comes in like this: > > data = ['RULES', 'title','sub

Re: Python's BNF

2008-02-29 Thread MartinRinehart
Steve Holden wrote: > I wish you'd stop trying to defend this code and simply admit that it's > just a throwaway program to which no real significance should be > attached. *Then* I'll leave you alone ;-) You're hurting my program's feelings! Actually, I intend to keep this program as the nice H

Re: joining strings question

2008-02-29 Thread baku
On Feb 29, 4:09 pm, [EMAIL PROTECTED] wrote: > Hi all, > > I have some data with some categories, titles, subtitles, and a link > to their pdf and I need to join the title and the subtitle for every > file and divide them into their separate groups. > > So the data comes in like this: > > data = ['

Re: Run wxPython app remotely under XWindows

2008-02-29 Thread Mike Driscoll
On Feb 28, 7:49 pm, Sean DiZazzo <[EMAIL PROTECTED]> wrote: > On Feb 28, 5:26 pm, Sean DiZazzo <[EMAIL PROTECTED]> wrote: > > > > > On Feb 28, 3:50 pm, Bjoern Schliessmann > > [EMAIL PROTECTED]> wrote: > > > Sean DiZazzo wrote: > > > > Is there something special you have to do to get a wxPython ap

Re: Python's BNF

2008-02-29 Thread MartinRinehart
Paul McGuire wrote: < plus sundry other parts of the kitchen > sink) that was passed BY PROJECT CODING STANDARDS to EVERY FUNCTION IN > EVERY MODULE! Supposedly, this was done to cure access problems to a > global data structure. Beautiful example of how totally stupid actions can be taken in t

Re: is there enough information?

2008-02-29 Thread Gerard Flanagan
On Feb 29, 7:55 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Thu, 28 Feb 2008 00:54:44 -0800 (PST), [EMAIL PROTECTED] declaimed > the following in comp.lang.python: > > > On Feb 28, 2:30 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > ### I smell Java burning... +1 QOTW "Mistah Kur

Re: Raising exception on STDIN read

2008-02-29 Thread Ian Clark
On 2008-02-28, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > I hope it's more clear now. Python objects are only meaningful *inside* a > Python program, but an *external* program can't use them directly. Yes, sorry. This is what I was getting hung up on. My thinking was that subprocess was orch

Re: Problem round-tripping with xml.dom.minidom pretty-printer

2008-02-29 Thread Robert Bossy
Ben Butler-Cole wrote: > Hello > > I have run into a problem using minidom. I have an HTML file that I > want to make occasional, automated changes to (adding new links). My > strategy is to parse it with minidom, add a node, pretty print it and > write it back to disk. > > However I find that ever

Re: Problem round-tripping with xml.dom.minidom pretty-printer

2008-02-29 Thread Ben Butler-Cole
> The last line of p() calls itself: it is an unconditional recursive call > so, no matter what it does, it will never stop. And since p() also > prints something, calling it will print endlessly. Sorry, I wasn't clear. I realize that this recurses endlessly. The problem is that it also adds blank

Re: call by reference howto????

2008-02-29 Thread castironpi
On Feb 29, 8:12 am, Steve Holden <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > On Feb 29, 5:56 am, Steve Holden <[EMAIL PROTECTED]> wrote: > >> [EMAIL PROTECTED] wrote: > >>> On Feb 27, 6:02 pm, Tamer Higazi <[EMAIL PROTECTED]> wrote: > Hi! > Can somebody of you make me a samp

Re: Indentation and optional delimiters

2008-02-29 Thread castironpi
On Feb 29, 8:59 am, Steve Holden <[EMAIL PROTECTED]> wrote: > Steve Holden wrote: > > [EMAIL PROTECTED] wrote: > > [...] > >  > If you want a computer language to model human thought, then is there > >> even such thing as subclassing? > > > Kindly try to limit your ramblings to answerable questions

Re: Problem round-tripping with xml.dom.minidom pretty-printer

2008-02-29 Thread Robert Bossy
Ben Butler-Cole wrote: >> An additional thing to keep in mind is that toprettyxml does not print >> an XML identical to the original DOM tree: it adds newlines and tabs. >> When parsed again these blank characters are inserted in the DOM tree as >> character nodes. If you toprettyxml an XML documen

Re: feedback requested

2008-02-29 Thread castironpi
On Feb 29, 5:52 am, [EMAIL PROTECTED] wrote: > On Feb 29, 12:55 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > > > On Thu, 28 Feb 2008 08:09:01 -0800 (PST), [EMAIL PROTECTED] declaimed > > the following in comp.lang.python: > > > > My goal is to return Deadlock from acquire() if its blocking wo

Re: Nested module import clutters package namespace?

2008-02-29 Thread Matthew Woodcraft
<[EMAIL PROTECTED]> wrote: > I'd be grateful for help with a problem of package and module=20 > namespaces. The behaviour I observe is unexpected (to me), and I=20 > couldn't find the answer in the docs, the tutorial, or the mailing=20 > list archive. So here we go: > I have a package named 'pack'

Re: call by reference howto????

2008-02-29 Thread Aahz
In article <[EMAIL PROTECTED]>, Steve Holden <[EMAIL PROTECTED]> wrote: > >As near as I can make out you appear to want to have thang delegate >certain of its method to thang.this. The easiest way to do that would be >to implement a __getattr__() in the Thang class to do so, but remember >that

Re: joining strings question

2008-02-29 Thread I V
On Fri, 29 Feb 2008 08:18:54 -0800, baku wrote: > return s == s.upper() A couple of people in this thread have used this to test for an upper case string. Is there a reason to prefer it to s.isupper() ? -- http://mail.python.org/mailman/listinfo/python-list

Re: joining strings question

2008-02-29 Thread Tim Chase
I V wrote: > On Fri, 29 Feb 2008 08:18:54 -0800, baku wrote: >> return s == s.upper() > > A couple of people in this thread have used this to test for an upper > case string. Is there a reason to prefer it to s.isupper() ? For my part? forgetfulness brought on by underuse of .isupper() -tk

at-exit-thread

2008-02-29 Thread castironpi
The Python main interpreter has an at-exit list of callables, which are called when the interpreter exits. Can threads have one? What's involved, or is the best way merely to subclass Thread? -- http://mail.python.org/mailman/listinfo/python-list

Re: joining strings question

2008-02-29 Thread Steve Holden
I V wrote: > On Fri, 29 Feb 2008 08:18:54 -0800, baku wrote: >> return s == s.upper() > > A couple of people in this thread have used this to test for an upper > case string. Is there a reason to prefer it to s.isupper() ? In my case you can put it down to ignorance or forgetfulness, dependi

Re: why not bisect options?

2008-02-29 Thread Raymond Hettinger
[Robert Bossy] > I thought it would be useful if insort and consorts* could accept the > same options than list.sort, especially key and cmp. If you're going to do many insertions or searches, wouldn't it be *much* more efficient to store your keys in a separate array? The sort() function guarant

Re: at-exit-thread

2008-02-29 Thread castironpi
On Feb 29, 1:55 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] schrieb: > > > The Python main interpreter has an at-exit list of callables, which > > are called when the interpreter exits.  Can threads have one?  What's > > involved, or is the best way merely to subclass Thre

Re: joining strings question

2008-02-29 Thread Peter Otten
I V wrote: > On Fri, 29 Feb 2008 08:18:54 -0800, baku wrote: >> return s == s.upper() > > A couple of people in this thread have used this to test for an upper > case string. Is there a reason to prefer it to s.isupper() ? Note that these tests are not equivalent: >>> s = "123" >>> s.isuppe

Re: joining strings question

2008-02-29 Thread Gerard Flanagan
On Feb 29, 7:56 pm, I V <[EMAIL PROTECTED]> wrote: > On Fri, 29 Feb 2008 08:18:54 -0800, baku wrote: > > return s == s.upper() > > A couple of people in this thread have used this to test for an upper > case string. Is there a reason to prefer it to s.isupper() ? Premature decreptiude, officer

Re: at-exit-thread

2008-02-29 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: > The Python main interpreter has an at-exit list of callables, which > are called when the interpreter exits. Can threads have one? What's > involved, or is the best way merely to subclass Thread? Is that some sort of trick-question? class MyThread(Thread): def

Re: at-exit-thread

2008-02-29 Thread castironpi
On Feb 29, 2:12 pm, [EMAIL PROTECTED] wrote: > On Feb 29, 1:55 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > > > > > > > [EMAIL PROTECTED] schrieb: > > > > The Python main interpreter has an at-exit list of callables, which > > > are called when the interpreter exits.  Can threads have one?  

Re: How to subclass a built-in int type and prevent comparisons

2008-02-29 Thread Terry Reedy
"Bronner, Gregory" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | The native implementation of int goes to great lengths to allow | illogical comparisons such as the one below. | >>> import xml as x | >>> x | >>> | | >>> x>4 | True | >>> x<4 | False Python once made all objects c

How to subclass a built-in int type and prevent comparisons

2008-02-29 Thread Bronner, Gregory
I'm trying to create a type-safe subclass of int (SpecialInt) such that instances of the class can only be compared with ints, longs, and other subclasses of SpecialInt -- I do not want them to be compared with floats, bools, or strings, which the native int implementation supports. Obviously, I c

Re: convert string number to real number - ValueError: invalid literal for int() with base 10: '"2"'

2008-02-29 Thread [EMAIL PROTECTED]
> You have to get rid of the double quotes first. you mean replace them with nothing? li[4].replace('"','') once i do that, i should be able to use them as numbers. -- http://mail.python.org/mailman/listinfo/python-list

Re: why not bisect options?

2008-02-29 Thread castironpi
On Feb 29, 1:15 pm, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > [Robert Bossy] > > > I thought it would be useful if insort and consorts* could accept the > > same options than list.sort, especially key and cmp. > > If you're going to do many insertions or searches, wouldn't it be > *much* more

Re: How to subclass a built-in int type and prevent comparisons

2008-02-29 Thread castironpi
On Feb 29, 3:09 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > "Bronner, Gregory" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > | The native implementation of int goes to great lengths to allow > | illogical comparisons such as the one below. > | >>> import xml as x > | >>> x >

Re: How about adding rational fraction to Python?

2008-02-29 Thread Terry Reedy
"Ross Ridge" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | Ross Ridge wrote: | > You're just going to have to accept that there that there is no | > concensus on this issue and there never was. | | Steven D'Aprano <[EMAIL PROTECTED]> wrote: | >But that's not true. The consensus,

Re: How about adding rational fraction to Python?

2008-02-29 Thread Terry Reedy
"Arnaud Delobelle" <[EMAIL PROTECTED]> wrote in message | What screws me is that I'm going to have to type p//q in the future. When I compare that pain to the gain of not having to type an otherwise extraneous 'float(...)', and the gain of disambiguating the meaning of a/b (for builtin numbers

Re: convert string number to real number - ValueError: invalid literal for int() with base 10: '"2"'

2008-02-29 Thread Terry Reedy
"davidj411" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] |i am parsing a cell phone bill to get a list of all numbers and the | total talktime spend on each number. | | i already have a unique list of the phone numbers. | now i must go through the list of numbers and add up the tot

Telnet versus telnetlib

2008-02-29 Thread Sean Davis
I have used command-line telnet to login to a host, paste into the window a small XML file, and then ^] to leave the window, and quit. This results in a page (described by the XML file) being printed on a printer. When I do an analogous process using telnetlib, I get no debug output, and most impo

Re: at-exit-thread

2008-02-29 Thread Preston Landers
On Feb 29, 2:12 pm, [EMAIL PROTECTED] wrote: > If a thread adds an object it creates to a nonlocal > collection, such as a class-static set, does it have to maintain a > list of all such objects, just to get the right ones destroyed on > completion?   Yes. > Processes destroy their garbage hassle

Re: Python's BNF

2008-02-29 Thread Gabriel Genellina
En Fri, 29 Feb 2008 15:01:49 -0200, <[EMAIL PROTECTED]> escribió: > _OFILE, by the way, is the output file. It's contract with the rest of > the module was > to be available for writing to anyone with data to write. I use the > Java convention > of ALLCAPS for naming things that I would declare as

Re: How about adding rational fraction to Python?

2008-02-29 Thread Arnaud Delobelle
On Feb 29, 10:10 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > "Arnaud Delobelle" <[EMAIL PROTECTED]> wrote in message > > | What screws me is that I'm going to have to type p//q in the future. > > When I compare that pain to the gain of not having to type an otherwise > extraneous 'float(...)', a

Re: convert string number to real number - ValueError: invalid literal for int() with base 10: '"2"'

2008-02-29 Thread D'Arcy J.M. Cain
On Fri, 29 Feb 2008 13:32:15 -0800 (PST) "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > > You have to get rid of the double quotes first. > > you mean replace them with nothing? > > li[4].replace('"','') Sure, that will do. However, look at the csv module for another way of handling this.

Re: more pythonic

2008-02-29 Thread Alan Isaac
Paul McGuire wrote: > In general, whenever you have: > someNewList = [] > for smthg in someSequence: > if condition(smthg): > someNewList.append( elementDerivedFrom(smthg) ) > replace it with: > someNewList = [ elementDerivedFrom(smthg) >

Getting a free TCP port & blocking it

2008-02-29 Thread theneb
Hi all, I'm attempting to block a TCP port from any other application from using it until I free it from python, this is so that: 1). Generate a random free user-space port 2). Generate the script for the external program with the port 3). Free the port before external program execution. This is w

Python COM automation - Controlling Microsoft Agent

2008-02-29 Thread Kamilche
Here's a snippet of code for pythoners to enjoy. Make the Microsoft genie speak text and dance about! ''' Requires: -- comtypes from: http://starship.python.net/crew/theller/comtypes MS Agent from: http://www.microsoft.com/msagent To do: -- 1. List availab

Re: (Newbie) Help with sockets.

2008-02-29 Thread mentaltruckdriver
On Feb 29, 9:42 am, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2008-02-29, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > >> You claim to be writing a telnet server, yet I don't see any > >> code that actually implements the telnet protocol. Different > >> telnet clients default to different m

Re: How about adding rational fraction to Python?

2008-02-29 Thread Lie
On Feb 28, 10:00 am, Paul Rubin wrote: > More examples: > >x = 1 >y = len(s) + x > > => ok, decides that x is an int > >x = 1 >y = x + 3.0 > > => ok, decides that x is a float > >x = 1 >y = x + 3.0 >z = len(s) + x > > => forbidden, x cannot be

Re: How about adding rational fraction to Python?

2008-02-29 Thread Dan Bishop
On Feb 29, 12:55 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Thu, 28 Feb 2008 10:39:51 -, Steven D'Aprano > <[EMAIL PROTECTED]> declaimed the following in > comp.lang.python: > > > By that logic, we should see this: > > > >>> len("a string") > > '8' > > Why? len() is a functio

Odd behaviour with list comprehension

2008-02-29 Thread Ken Pu
Hi all, I observed an interesting yet unpleasant variable scope behaviour with list comprehension in the following code: print [x for x in range(10)] print x It outputs: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] 9 So the list comprehension actually creates a variable x which is somewhat unexpected. Is th

Re: more pythonic

2008-02-29 Thread Paul McGuire
On Feb 29, 5:57 pm, Alan Isaac <[EMAIL PROTECTED]> wrote: > Paul McGuire wrote: > > In general, whenever you have: > >     someNewList = [] > >     for smthg in someSequence: > >         if condition(smthg): > >             someNewList.append( elementDerivedFrom(smthg) ) > > replace it with: > >  

Re: convert string number to real number - ValueError: invalid literal for int() with base 10: '"2"'

2008-02-29 Thread George Sakkis
On Feb 28, 5:56 pm, davidj411 <[EMAIL PROTECTED]> wrote: > i am parsing a cell phone bill to get a list of all numbers and the > total talktime spend on each number. > > (snipped) > > I actually found a good solution. > (snipped) If you post 1-2 samples of the cell phone bill input, I am sure you

Re: Is crawling the stack "bad"? Why?

2008-02-29 Thread Stephen Hansen
> > > Seriously, crawling the stack introduces the potential for disaster in > > your program, since there is no guarantee that the calling code will > > provide the same environment i future released. So at best you tie your > > solution to a particular version of a particular implementation of >

Re: Odd behaviour with list comprehension

2008-02-29 Thread Micah Cowan
"Ken Pu" <[EMAIL PROTECTED]> writes: > Hi all, > > I observed an interesting yet unpleasant variable scope behaviour with > list comprehension in the following code: > > print [x for x in range(10)] > print x > > It outputs: > > [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] > 9 > > So the list comprehension actu

Re: Odd behaviour with list comprehension

2008-02-29 Thread Jerry Hill
On Fri, Feb 29, 2008 at 10:01 PM, Ken Pu <[EMAIL PROTECTED]> wrote: > Is there a way for me keep the iterating variable in list > comprehension local to the list comprehension? Kind of. You can use a generator expression instead of a list comprehension, and those don't leak their internal varia

Re: Odd behaviour with list comprehension

2008-02-29 Thread Micah Cowan
"Jerry Hill" <[EMAIL PROTECTED]> writes: > On Fri, Feb 29, 2008 at 10:01 PM, Ken Pu <[EMAIL PROTECTED]> wrote: >> Is there a way for me keep the iterating variable in list >> comprehension local to the list comprehension? > > Kind of. You can use a generator expression instead of a list > compr

Re: Odd behaviour with list comprehension

2008-02-29 Thread Jeffrey Froman
Ken Pu wrote: > So the list comprehension actually creates a variable x which is > somewhat unexpected. > Is there a way for me keep the iterating variable in list > comprehension local to the list comprehension? Not with a list comprehension, but generator expressions do not leak their iterating

Re: anydbm safe for simultaneous writes?

2008-02-29 Thread Eric S. Johansson
chris wrote: > I need simple data persistence for a cgi application that will be used > potentially by multiple clients simultaneously. So I need something > that can handle locking among writes. Sqlite probably does this, but > I am using Python 2.4.4, which does not include sqlite. The dbm-sty

Re: Backup Script over ssh

2008-02-29 Thread Eric S. Johansson
Gabriel Genellina wrote: > En Wed, 27 Feb 2008 13:32:07 -0200, Christian Kortenhorst > <[EMAIL PROTECTED]> escribi�: > >> But there is no rsync for windows without using cygwin > > That's no big deal; rsync doesn't require tons of libraries, just > cygpopt-0.dll and cygwin1.dll. See this page

Re: How about adding rational fraction to Python?

2008-02-29 Thread Steve Holden
Dan Bishop wrote: > On Feb 29, 12:55 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: >> On Thu, 28 Feb 2008 10:39:51 -, Steven D'Aprano >> <[EMAIL PROTECTED]> declaimed the following in >> comp.lang.python: >> >>> By that logic, we should see this: >> len("a string") >>> '8' >> Why

Re: How about adding rational fraction to Python?

2008-02-29 Thread Terry Reedy
"Arnaud Delobelle" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | Perhaps it'll be like when I quit smoking six years ago. I didn't | enjoy it although I knew it was good for me... And now I don't regret | it even though I still have the occasional craving. In following the devel

Re: at-exit-thread

2008-02-29 Thread castironpi
On Feb 29, 4:34 pm, Preston Landers <[EMAIL PROTECTED]> wrote: > On Feb 29, 2:12 pm, [EMAIL PROTECTED] wrote: > > > If a thread adds an object it creates to a nonlocal > > collection, such as a class-static set, does it have to maintain a > > list of all such objects, just to get the right ones de

Re: at-exit-thread

2008-02-29 Thread Gabriel Genellina
En Fri, 29 Feb 2008 18:12:13 -0200, <[EMAIL PROTECTED]> escribió: > On Feb 29, 1:55 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >> [EMAIL PROTECTED] schrieb: >> >> > The Python main interpreter has an at-exit list of callables, which >> > are called when the interpreter exits.  Can threads h

Re: Telnet versus telnetlib

2008-02-29 Thread Gabriel Genellina
En Fri, 29 Feb 2008 20:34:41 -0200, Sean Davis <[EMAIL PROTECTED]> escribió: > When I do an analogous process using telnetlib, I get no debug output, > and most importantly, when I send the XML file to the host, I get no > printed page. Unfortunately, I do not have access to the host to do > tr

Re: rstrip error python2.4.3 not in 2.5.1?

2008-02-29 Thread Tim Roberts
dirkheld <[EMAIL PROTECTED]> wrote: >> >> What is the actual error message [SyntaxError, NameError? etc] that you >> clipped? > >Here it is : I tought that I didn't matter because the deliciousapi >worked fine on my mac. > >Traceback (most recent call last): > File "delgraph.py", line 62, in ? >

Re: pySQLite Insert speed

2008-02-29 Thread Tim Roberts
[EMAIL PROTECTED] wrote: > >I hav read on this forum that SQL coding (A) below is preferred over >(B), but I find (B) is much faster (20-40% faster) > >(A) > >sqla= 'INSERT INTO DTABLE1 VALUES (%d, %d, %d, %f)' % values >curs.execute(sqla) > >(B) > pf= '?, ?, ?, ?' >sqlxb= 'INSERT

Re: Decorators and buffer flushing

2008-02-29 Thread Ethan Metsger
On Thu, 28 Feb 2008 15:04:38 -0500, Ethan Metsger <[EMAIL PROTECTED]> wrote: > > I can reproduce the issue in the console. I'm not convinced it's > actually > a bug, unless for some reason the interpreter is preventing a buffer > flush. Quick question. Having eliminated some of the other

Re: Getting a free TCP port & blocking it

2008-02-29 Thread Tim Roberts
theneb <[EMAIL PROTECTED]> wrote: >Hi all, >I'm attempting to block a TCP port from any other application from >using it until I free it from python, this is so that: >1). Generate a random free user-space port >2). Generate the script for the external program with the port >3). Free the port befor

Re: Run wxPython app remotely under XWindows

2008-02-29 Thread Sean DiZazzo
On Feb 29, 8:19 am, Mike Driscoll <[EMAIL PROTECTED]> wrote: > On Feb 28, 7:49 pm, Sean DiZazzo <[EMAIL PROTECTED]> wrote: > > > > > On Feb 28, 5:26 pm, Sean DiZazzo <[EMAIL PROTECTED]> wrote: > > > > On Feb 28, 3:50 pm, Bjoern Schliessmann > > > [EMAIL PROTECTED]> wrote: > > > > Sean DiZazzo wrot

  1   2   >