[OT] Re: are there some special about '\x1a' symbol

2009-01-12 Thread Gabriel Genellina
En Mon, 12 Jan 2009 12:00:16 -0200, John Machin escribió: I didn't think your question was stupid. Stupid was (a) CP/M recording file size as number of 128-byte sectors, forcing the use of an in-band EOF marker for text files (b) MS continuing to regard Ctrl-Z as an EOF decades after people s

Extracting real-domain-name (without sub-domains) from a given URL

2009-01-12 Thread S.Selvam Siva
Hi all, I need to extract the domain-name from a given url(without sub-domains). With urlparse, i am able to fetch only the domain-name(which includes the sub-domain also). eg: http://feeds.huffingtonpost.com/posts/ , http://www.huffingtonpost.de/, all must lead to *huffingtonpost.com or

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-12 Thread Steve Holden
Hendrik van Rooyen wrote: > "Steve Holden" wrote: > >> r wrote: (about another Steven) > >>> WOW Steven, i am very impressed. That's the first thing you have said >>> in a very long time that i totally agree with! Keep this up and i may >>> put you back on my Python Brethren list :) >> What can

Attaching a live interpreter to a script?

2009-01-12 Thread Kannon
I'm sure this has come up before, but my google-fu is just not strong enough to find it out of 10,000~ posts, and apologies if this is obvious. What I'd like to do is attach an interpreter to a program running from a script (I.E, not something I typed into the live interpreter). It'd be an awesome

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-12 Thread Hendrik van Rooyen
"Steve Holden" wrote: > r wrote: (about another Steven) > > WOW Steven, i am very impressed. That's the first thing you have said > > in a very long time that i totally agree with! Keep this up and i may > > put you back on my Python Brethren list :) > > What can one do to get *off* it? ;-) ee

Re: Ternary operator and tuple unpacking -- What am I missing ?

2009-01-12 Thread Tim Roberts
imageguy wrote: >Using py2.5.4 and entering the following lines in IDLE, I don't really >understand why I get the result shown in line 8. > >Note the difference between lines 7 and 10 is that 'else' clause >result enclosed in brackets, however, in line 2, both the 'c,d' >variables are assign corr

Re: Problems in Using C-API for Unicode handling

2009-01-12 Thread Terry Reedy
abhi wrote: Hi, I am trying to handle Unicode objects in C (Python 2.5.2). I am getting PyObjects from and want to coerce them to unicode objects. The documentation provides two APIs for that: PyUnicode_FromEncodedObject(PyObject *obj, const char *encoding, const char *errors) PyUnicode_Fr

Problems in Using C-API for Unicode handling

2009-01-12 Thread abhi
Hi, I am trying to handle Unicode objects in C (Python 2.5.2). I am getting PyObjects from and want to coerce them to unicode objects. The documentation provides two APIs for that: PyUnicode_FromEncodedObject(PyObject *obj, const char *encoding, const char *errors) PyUnicode_FromObject(PyObj

Re: [urllib2] 302 -> can't get cookie

2009-01-12 Thread Gabriel Genellina
En Wed, 07 Jan 2009 09:27:00 -0200, Gilles Ganault escribió: I'm using urllib2 to connect to a web server with POST, and then the server sends a cookie to hold the session ID, but also redirects the user to another page: If you're still interested, the way to avoid a redirect would be to us

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-12 Thread Steve Holden
Paul Rubin wrote: > r writes: >> Python and Ruby. Ruby only exists in this world because of the things >> it took from Python. Nobody would touch Ruby without it's Pythonisms. > > I confess to not knowing much about Ruby. It looks sort of Perl-ish > to me, and I always hear it is slower than Pyt

Re: [ANN] The Python Papers Volume 3 Issue 3

2009-01-12 Thread Steve Holden
mauricel...@acm.org wrote: > Hi everyone > > First of all, let me apologize for the delay of this issue of TPP. I > understand that all of you had been anxiously waiting and I do > sincerely apologize that Christmas and New Year celebrations are > taking a toll on my time. > > Finally, here it is

Re: Ternary operator and tuple unpacking -- What am I missing ?

2009-01-12 Thread Steve Holden
Miles wrote: > On Tue, Jan 13, 2009 at 12:02 AM, imageguy wrote: >> Using py2.5.4 and entering the following lines in IDLE, I don't really >> understand why I get the result shown in line 8. >> >> Note the difference between lines 7 and 10 is that 'else' clause >> result enclosed in brackets, howe

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-12 Thread Steve Holden
bieff...@gmail.com wrote: > On 12 Gen, 14:45, Paul Rubin wrote: >> bieff...@gmail.com writes: class Foo (DynamicAttributes, object): pass >>> You cannot do that, but you can establish a fixed set of attributes by >>> defining the __slot__ class variable. >> Th

Re: Problem with -3 switch

2009-01-12 Thread Steve Holden
Christian Heimes wrote: >>> Perhaps you also like to hear from a developer who has worked on Python >>> 3.0 itself and who has done lots of work with internationalized >>> applications. If you want to get it right you must >>> >>> * decode incoming text data to unicode as early as possible >>> * us

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-12 Thread Steve Holden
r wrote: > [stevie] > On the other hand... Bruno's question is unfair. It is perfectly > reasonable to (hypothetically) consider Python to be the best > *existing* > language while still wanting it to be improved (for some definition > of > improvement). Just because somebody has criticisms of Pyth

Re: win32gui

2009-01-12 Thread Tim Roberts
Gandalf wrote: ? >Hi, everyone >I'm searching the win32gui lib to find a way to get the text under the >user cursor. >so far I managed to find only the controller ID which under the cursor >this way > >cursorID = win32gui.WindowFromPoint(win32gui.GetCursorPos()) > >their is function called GetWind

Re: urllib2 - 403 that _should_ not occur.

2009-01-12 Thread Steve Holden
Philip Semanchuk wrote: > > On Jan 12, 2009, at 6:48 PM, ajaksu wrote: > >> On Jan 11, 11:59 pm, "James Mills" >> wrote: >>> Hey all, >>> >>> The following fails for me: >>> >> from urllib2 import urlopen >> f = >> urlopen("http://groups.google.com/group/chromium-announce/feed/rss_v2

Re: python3.0 MySQLdb

2009-01-12 Thread Steve Holden
Daniel Fetchinson wrote: >> I need something to connect to a database, preferably mysql, that >> works in python3.0 please. > > And your question is? > > Surely it's fairly obvious that the question is "does such a thing exist, and if so where can I find it?". If that isn't obvious then please c

Re: efficient interval containment lookup

2009-01-12 Thread brent
On Jan 12, 9:34 pm, Per Freem wrote: > hi brent, thanks very much for your informative reply -- didn't > realize this about the size of the interval. > > thanks for the bx-python link.  could you (or someone else) explain > why the size of the interval makes such a big difference? i don't > unders

Re: BadZipfile "file is not a zip file"

2009-01-12 Thread Steve Holden
webcomm wrote: > On Jan 12, 11:53 am, "Chris Mellon" wrote: [file distribution horror story ...] >> It's worth pointing out (although the provider probably doesn't care) >> that this isn't really an XML document and this was a bad way of them >> to distribute the data. If they'd used a correctly f

Re: File buffer flush issue in multi-process in Windows

2009-01-12 Thread javen72
On 1月13日, 下午2时03分, jave...@gmail.com wrote: > Hi, > > I encountered a very strange issue in file flush operation in Windows. > Here's the scenario of my application: > > 1. The main thread of my application will create makefiles > sequentially. > 2. Once a makefile is generated, launch a ne

File buffer flush issue in multi-process in Windows

2009-01-12 Thread javen72
Hi, I encountered a very strange issue in file flush operation in Windows. Here's the scenario of my application: 1. The main thread of my application will create makefiles sequentially. 2. Once a makefile is generated, launch a new process calling nmake.exe to run it. The main thread the

Re: Ternary operator and tuple unpacking -- What am I missing ?

2009-01-12 Thread Miles
On Tue, Jan 13, 2009 at 12:02 AM, imageguy wrote: > Using py2.5.4 and entering the following lines in IDLE, I don't really > understand why I get the result shown in line 8. > > Note the difference between lines 7 and 10 is that 'else' clause > result enclosed in brackets, however, in line 2, both

Re: efficient interval containment lookup

2009-01-12 Thread Steven D'Aprano
On Mon, 12 Jan 2009 20:55:36 -0800, Per Freem wrote: > on one run, i get: > interval tree: 8584.682 > brute force: 8201.644 Here are three runs on my computer: interval tree: 10132.682 brute force: 12054.988 interval tree: 10355.058 brute force: 12119.227 interval tree: 9975.414 brute force:

Re: efficient interval containment lookup

2009-01-12 Thread Per Freem
hi brent, thanks very much for your informative reply -- didn't realize this about the size of the interval. thanks for the bx-python link. could you (or someone else) explain why the size of the interval makes such a big difference? i don't understand why it affects efficiency so much... thanks

Re: efficient interval containment lookup

2009-01-12 Thread brent
On Jan 12, 8:55 pm, Per Freem wrote: > On Jan 12, 10:58 pm, Steven D'Aprano > > > > wrote: > > On Mon, 12 Jan 2009 14:49:43 -0800, Per Freem wrote: > > > thanks for your replies -- a few clarifications and questions. the > > > is_within operation is containment, i.e. (a,b) is within (c,d) iff a >

Re: Ternary operator and tuple unpacking -- What am I missing ?

2009-01-12 Thread imageguy
> understand why I get the result shown in line 8. >7) >>> c,d = n if n is not None else 0,0 >8) >>> print c,d >9) (22, 11) 0 OOPS sorry that should be line 9. g. -- http://mail.python.org/mailman/listinfo/python-list

Ternary operator and tuple unpacking -- What am I missing ?

2009-01-12 Thread imageguy
Using py2.5.4 and entering the following lines in IDLE, I don't really understand why I get the result shown in line 8. Note the difference between lines 7 and 10 is that 'else' clause result enclosed in brackets, however, in line 2, both the 'c,d' variables are assign correctly without the bracke

Re: efficient interval containment lookup

2009-01-12 Thread Per Freem
i forgot to add, my naive_find is: def naive_find(intervals, start, stop): results = [] for interval in intervals: if interval.start >= start and interval.stop <= stop: results.append(interval) return results On Jan 12, 11:55 pm, Per Freem wrote: > On Jan 12, 10:58 pm, Steven D'A

Re: Implementing file reading in C/Python

2009-01-12 Thread Grant Edwards
On 2009-01-13, Steve Holden wrote: > sturlamolden wrote: >> On Jan 12, 1:52 pm, Sion Arrowsmith >> wrote: >> >>> And today's moral is: try it before posting. Yeah, I can map a 2GB >>> file no problem, complete with associated 2GB+ allocated VM. The >>> addressing is clearly not working how I was

Re: efficient interval containment lookup

2009-01-12 Thread Per Freem
On Jan 12, 10:58 pm, Steven D'Aprano wrote: > On Mon, 12 Jan 2009 14:49:43 -0800, Per Freem wrote: > > thanks for your replies -- a few clarifications and questions. the > > is_within operation is containment, i.e. (a,b) is within (c,d) iff a > >>= c and b <= d. Note that I am not looking for inte

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-12 Thread Paul Rubin
r writes: > Python revolutionized the world of programming and exposed the other > languages for what they are. Archaic, and redundant pieces of > petrified dino dookie. ... We must fight to get Python in every API we > can. We must stay on our toes and not let Ruby one-up us! I do not > want to

Re: Unexpected behavior with dictionary keys containment and a user-defined class

2009-01-12 Thread Rob Clewley
>> Hi, the short version of my question is: when is a dictionary's >> __contains__ method behavior different to using the 'in' idiom? >> (because I have an example of a difference in my code). > > Never. Yes, sorry, I managed to summarize the long version incorrectly :) > Well, the only conclusio

Re: Unexpected behavior with dictionary keys containment and a user-defined class

2009-01-12 Thread Steven D'Aprano
On Mon, 12 Jan 2009 22:41:00 -0500, Rob Clewley wrote: > Hi, the short version of my question is: when is a dictionary's > __contains__ method behavior different to using the 'in' idiom? (because > I have an example of a difference in my code). [...] > i in d.keys() and d.keys()[10] == i > >

Re: efficient interval containment lookup

2009-01-12 Thread Steven D'Aprano
On Mon, 12 Jan 2009 14:49:43 -0800, Per Freem wrote: > thanks for your replies -- a few clarifications and questions. the > is_within operation is containment, i.e. (a,b) is within (c,d) iff a >>= c and b <= d. Note that I am not looking for intervals that > overlap... this is why interval trees s

Re: Unexpected behavior with dictionary keys containment and a user-defined class

2009-01-12 Thread James Stroud
Rob Clewley wrote: Hi, the short version of my question is: when is a dictionary's __contains__ method behavior different to using the 'in' idiom? (because I have an example of a difference in my code). Never. Longer version: I have a user-defined class with a few overrides of special methods

Unexpected behavior with dictionary keys containment and a user-defined class

2009-01-12 Thread Rob Clewley
Hi, the short version of my question is: when is a dictionary's __contains__ method behavior different to using the 'in' idiom? (because I have an example of a difference in my code). Longer version: I have a user-defined class with a few overrides of special methods, particularly __eq__ and __ne_

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-12 Thread r
On Jan 12, 5:34 pm, Paul Rubin wrote: > r writes: > > Python and Ruby. Ruby only exists in this world because of the things > > it took from Python. Nobody would touch Ruby without it's Pythonisms. > > I confess to not knowing much about Ruby.  It looks sort of Perl-

Re: urllib2 - 403 that _should_ not occur.

2009-01-12 Thread Philip Semanchuk
On Jan 12, 2009, at 6:48 PM, ajaksu wrote: On Jan 11, 11:59 pm, "James Mills" wrote: Hey all, The following fails for me: from urllib2 import urlopen f = urlopen("http://groups.google.com/group/chromium-announce/feed/rss_v2_0_msgs.xml ") Traceback (most recent call last): [...] Any he

[ANN] The Python Papers Volume 3 Issue 3

2009-01-12 Thread mauricel...@acm.org
Hi everyone First of all, let me apologize for the delay of this issue of TPP. I understand that all of you had been anxiously waiting and I do sincerely apologize that Christmas and New Year celebrations are taking a toll on my time. Finally, here it is... Volume 3 Issue 3... And we are THIRD ye

Re: Mocking `from foo import *` functions

2009-01-12 Thread Silfheed
Brilliant, I love it. Thanks a million, guys. -- http://mail.python.org/mailman/listinfo/python-list

Re: Implementing file reading in C/Python

2009-01-12 Thread Steve Holden
sturlamolden wrote: > On Jan 12, 1:52 pm, Sion Arrowsmith > wrote: > >> And today's moral is: try it before posting. Yeah, I can map a 2GB >> file no problem, complete with associated 2GB+ allocated VM. The >> addressing is clearly not working how I was expecting it too. > > The virtual memory s

Re: Implementing file reading in C/Python

2009-01-12 Thread Steve Holden
sturlamolden wrote: > On Jan 12, 1:52 pm, Sion Arrowsmith > wrote: > >> And today's moral is: try it before posting. Yeah, I can map a 2GB >> file no problem, complete with associated 2GB+ allocated VM. The >> addressing is clearly not working how I was expecting it too. > > The virtual memory s

Scheduled Tasks - SetFlags

2009-01-12 Thread kj7ny
How do I enable/disable a scheduled task using Python? I can get to a task: self.ts=pythoncom.CoCreateInstance (taskscheduler.CLSID_CTaskScheduler,None,pythoncom.CLSCTX_INPROC_SERVER,taskscheduler.IID_ITaskScheduler) self.ts.SetTargetComputer(u'SomeServer') self.tasks=

Re: ActiveState Python Together with "Regular" Python) ((DLE)

2009-01-12 Thread Steve Holden
W. eWatson wrote: > John Machin wrote: >> On Jan 12, 9:16 pm, "W. eWatson" wrote: >>> John Machin wrote: On Jan 12, 2:00 pm, "W. eWatson" wrote: > I installed "Python" 2.5 a few months ago with IDLE, and decided > I'd like to > try windowpy from ActiveState. Is having both of the

Re: redirecting stderr back..

2009-01-12 Thread Steve Holden
Дамјан Георгиевски wrote: > >> Hi All, >> >> Can someone tell me how to redirect stderr back to the console once >> you've moved it? >> >> import os,sys >> se = os.open("/tmp/mod.log", os.O_WRONLY|os.O_APPEND|os.O_CREAT) >> sys.stderr.write("Foobar\n") >> Foobar >> os.dup2(se, 2) > > why not os.d

Re: Simple CGI-XMLRPC failure

2009-01-12 Thread Jeff McNeil
On Jan 12, 12:40 pm, "Mike MacHenry" wrote: > I am having a difficult time understanding why my very simple > CGI-XMLRPC test isn't working. I created a server to export two > functions, the built-in function "pow" and my own identity function > "i". I run a script to call both of them and the "po

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-12 Thread Russ P.
On Jan 12, 3:34 pm, Paul Rubin wrote: > r writes: > > Python and Ruby. Ruby only exists in this world because of the things > > it took from Python. Nobody would touch Ruby without it's Pythonisms. > > I confess to not knowing much about Ruby. It looks sort of Perl-

Re: Unbinding Tkinter default bindings for Listbox

2009-01-12 Thread Roger
On Jan 12, 5:58 pm, James Stroud wrote: > James Stroud wrote: > > tk.tk.call('bind', str(lb), '', "break") > > Which is equivalent to > > lb.bind('', "break") > > But I checked and overriding the default behavior of Listbox does not > work (tk.tk.call('bind', "Listbox", '', "break")). > > So I wou

Re: read a password protected xls file

2009-01-12 Thread John Machin
On Jan 13, 3:35 am, thomas.steffe...@googlemail.com wrote: > Hello, > how can I read (and parse) a password protected xls file, perhaps with > the package xlrd? > Thanks for your hints, Thomas Perhaps not with xlrd. google("xlrd"); *first* hit displayed: """ Lingfo - xlrd extension 11 Jun 2007 ...

Re: Egg deinstallation

2009-01-12 Thread Jeff McNeil
On Jan 12, 9:36 am, mk wrote: > Hello everyone, > > I googled and googled and can't seem to find the definitive answer: how > to *properly* deinstall egg? Just delete the folder and/or .py and .pyc > files from Lib/site-packages? Would that break anything in Python > installation or not? > > Regar

Re: redirecting stderr back..

2009-01-12 Thread Дамјан Георгиевски
> Hi All, > > Can someone tell me how to redirect stderr back to the console once > you've moved it? > > import os,sys > se = os.open("/tmp/mod.log", os.O_WRONLY|os.O_APPEND|os.O_CREAT) > sys.stderr.write("Foobar\n") > Foobar > os.dup2(se, 2) why not os.dup2(2, 10) and then later os.dup2(10, 2

Re: Problem with -3 switch

2009-01-12 Thread Дамјан Георгиевски
> Perhaps you also like to hear from a developer who has worked on > Python 3.0 itself and who has done lots of work with internationalized > applications. If you want to get it right you must > > * decode incoming text data to unicode as early as possible > * use unicode for all internal text dat

Re: hlep: a text search and rename question

2009-01-12 Thread Steve Holden
sensen wrote: > On Jan 12, 10:41 pm, sensen wrote: >> both above works well, but a problem is renamed file is without >> filename extension. >> >> only change to the title. >> >> for example, the origin file is track_1.flac, after run the script i >> want it to for example, White Flag.flac, but no

Re: Problem with -3 switch

2009-01-12 Thread Carl Banks
On Jan 12, 5:03 pm, John Machin wrote: > On Jan 13, 6:12 am, Christian Heimes wrote: > > > > I say again, show me a case of working 2.5 code where prepending u to > > > an ASCII string constant that is intended to be used in a text context > > > is actually worth the keystrokes. > > > Eventually

Re: Egg deinstallation

2009-01-12 Thread excord80
On Jan 12, 9:36 am, mk wrote: > Hello everyone, > > I googled and googled and can't seem to find the definitive answer: how > to *properly* deinstall egg? Just delete the folder and/or .py and .pyc > files from Lib/site-packages? Would that break anything in Python > installation or not? As an as

Re: debugging ignored exceptions at cleanup

2009-01-12 Thread Diez B. Roggisch
Michele Simionato schrieb: In some conditions (typically with threads, __del__ methods, etc) the cleanup mechanism of Python gets in trouble and some exceptions are not raised but just printed on stderr. I have an application using Paste and when I run the tests I get some annoying ignored except

Re: urllib2 - 403 that _should_ not occur.

2009-01-12 Thread ajaksu
On Jan 11, 11:59 pm, "James Mills" wrote: > Hey all, > > The following fails for me: > > >>> from urllib2 import urlopen > >>> f = > >>> urlopen("http://groups.google.com/group/chromium-announce/feed/rss_v2_0_msgs.xml";) > > Traceback (most recent call last): [...] > Any helpful ideas ? Maybe ra

Re: Simple CGI-XMLRPC failure

2009-01-12 Thread Diez B. Roggisch
Mike MacHenry schrieb: I am having a difficult time understanding why my very simple CGI-XMLRPC test isn't working. I created a server to export two functions, the built-in function "pow" and my own identity function "i". I run a script to call both of them and the "pow" work fine but the "i" giv

Re: python3.0 MySQLdb

2009-01-12 Thread gert
Its for testing mod_wsgi trunk on Python3.0 in combination with a database. Does anybody has a patch for MySQLdb ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-12 Thread Paul Rubin
r writes: > Python and Ruby. Ruby only exists in this world because of the things > it took from Python. Nobody would touch Ruby without it's Pythonisms. I confess to not knowing much about Ruby. It looks sort of Perl-ish to me, and I always hear it is slower than Python, which is already too sl

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-12 Thread Lou Pecora
In article , Roy Smith wrote: > In article > <34c95e04-5b3f-44bc-a5bf-498518507...@p36g2000prp.googlegroups.com>, > "Madhusudan.C.S" wrote: > > > In such situations, where the Instance variables come into existence > > only when they are used it is very difficult to track the flow of code. >

Re: Problem with -3 switch

2009-01-12 Thread John Machin
On Jan 13, 6:12 am, Christian Heimes wrote: > > I say again, show me a case of working 2.5 code where prepending u to > > an ASCII string constant that is intended to be used in a text context > > is actually worth the keystrokes. > > Eventually you'll learn it the hard way. *sigh* And the hard w

Re: Unbinding Tkinter default bindings for Listbox

2009-01-12 Thread James Stroud
James Stroud wrote: tk.tk.call('bind', str(lb), '', "break") Which is equivalent to lb.bind('', "break") But I checked and overriding the default behavior of Listbox does not work (tk.tk.call('bind', "Listbox", '', "break")). So I would subclass Listbox and do the bindings in the __init__:

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-12 Thread r
On Jan 12, 3:58 pm, Paul Rubin wrote: > We are in an era for programming languages sort of like the Windows 95 > era was for operating systems, where everything is broken but some of > the fixes are beginning to come into view.  So there is no language > that currentl

Re: efficient interval containment lookup

2009-01-12 Thread Per Freem
thanks for your replies -- a few clarifications and questions. the is_within operation is containment, i.e. (a,b) is within (c,d) iff a >= c and b <= d. Note that I am not looking for intervals that overlap... this is why interval trees seem to me to not be relevant, as the overlapping interval pro

Re: Unbinding Tkinter default bindings for Listbox

2009-01-12 Thread James Stroud
Roger wrote: I'm sorry for harassing the list but any suggestions would be greatly appreciated. =) I just checked the behavior you are describing. It seems that you want to unbind the event to stop the autoscrolling when you leave the listbox. E.g.: from Tkinter import * tk = Tk() lb = Lis

Re: urllib2 - 403 that _should_ not occur.

2009-01-12 Thread Chris Mellon
On Mon, Jan 12, 2009 at 4:34 PM, Steven D'Aprano wrote: > On Mon, 12 Jan 2009 00:38:20 -0600, Chris Mellon wrote: > >>> Why Google would deny access to services by unknown User Agents is >>> beyond me - especially since in most cases User Agents strings are not >>> strict. >> >> If you look at the

Re: urllib2 - 403 that _should_ not occur.

2009-01-12 Thread Steven D'Aprano
On Mon, 12 Jan 2009 00:38:20 -0600, Chris Mellon wrote: >> Why Google would deny access to services by unknown User Agents is >> beyond me - especially since in most cases User Agents strings are not >> strict. > > If you look at the actual response text and not just the error code, you > will ge

Re: python3.0 MySQLdb

2009-01-12 Thread Martin v. Löwis
> I need something to connect to a database, preferably mysql, that > works in python3.0 please. For postgres, psycopg2 works with Python 3 (if you use my patch). Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: efficient interval containment lookup

2009-01-12 Thread Steven D'Aprano
On Mon, 12 Jan 2009 11:36:47 -0800, Per Freem wrote: > hello, > > suppose I have two lists of intervals, one significantly larger than the > other. [...] > What is an efficient way to this? One simple way is: http://en.wikipedia.org/wiki/Interval_tree > for a_range in listA: > for b_range i

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-12 Thread Paul Rubin
Steven D'Aprano writes: > *If* you don't like the way it works, and you have a choice in the > matter, perhaps you should find another language that works more the way > you would prefer. We are in an era for programming languages sort of like the Windows 95 era was for operating systems, where

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-12 Thread r
[stevie] On the other hand... Bruno's question is unfair. It is perfectly reasonable to (hypothetically) consider Python to be the best *existing* language while still wanting it to be improved (for some definition of improvement). Just because somebody has criticisms of Python, or a wish- list of

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-12 Thread Steven D'Aprano
On Mon, 12 Jan 2009 13:36:07 -0800, Paul Rubin wrote: > Bruno Desthuilliers writes: >> Why on earth are you using Python if you don't like the way it work ??? > > Why on earth keep releasing new versions of Python if the old ones are > already perfect? That's a fallacious argument. Nobody is ar

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-12 Thread r
On Jan 12, 2:06 pm, Bruno Desthuilliers wrote: > Why on earth are you using Python if you don't like the way it work ??? Why on earth are you busting into someone's thread just because you don't like what they have to say ??? -- http://mail.python.org/mailman/listinfo/python-list

Re: Python tricks

2009-01-12 Thread Robert Latest
RajNewbie wrote: > But, I still feel it would be much more aesthetically pleasing if I > can call a single procedure like > if infinite_loop() -> to do the same. You may find it aesthetically pleasing, and it may very well be, but it will obfuscate your code and make it less maintainable. robert

Re: Python tricks

2009-01-12 Thread Robert Latest
RajNewbie wrote: >Is there a way - a python trick - to have a check such that if the > loop goes for more than x number of steps, it will cause an exception? > >I do understand that we can use the code like - >i = 0 >while True: > i++ > if i > 200: raise infinite_Loop_Exce

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-12 Thread Paul Rubin
Bruno Desthuilliers writes: > Why on earth are you using Python if you don't like the way it work ??? Why on earth keep releasing new versions of Python if the old ones are already perfect? -- http://mail.python.org/mailman/listinfo/python-list

Re: Unbinding Tkinter default bindings for Listbox

2009-01-12 Thread Roger
I'm sorry for harassing the list but any suggestions would be greatly appreciated. =) -- http://mail.python.org/mailman/listinfo/python-list

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-12 Thread Bruno Desthuilliers
Paul Rubin a écrit : Carl Banks writes: The criticism is very valid. Some languages do support immutable variables (e.g. "final" declarations in Java, "const" in C++, or universal immutability in pure functional languages) and they do so precisely for the purpose of taming the chaos of uncontr

Re: efficient interval containment lookup

2009-01-12 Thread Robert Kern
[Apologies for piggybacking, but I think GMane had a hiccup today and missed the original post] [Somebody wrote]: suppose I have two lists of intervals, one significantly larger than the other. For example listA = [(10, 30), (5, 25), (100, 200), ...] might contain thousands of elements while li

Re: efficient interval containment lookup

2009-01-12 Thread Scott David Daniels
Are these ranges constrained in any way? Does preprocessing count in the efficiency cost? Is the long list or the short list fixed while the other varies? With no constraints the problem is harder. > But perhaps there's a way to index this that makes things more > efficient? I.e. a smart way of

Re: efficient interval containment lookup

2009-01-12 Thread Tim Chase
suppose I have two lists of intervals, one significantly larger than the other. For example listA = [(10, 30), (5, 25), (100, 200), ...] might contain thousands of elements while listB (of the same form) might contain hundreds of thousands or millions of elements. I want to count how many interval

Re: Problem with -3 switch

2009-01-12 Thread Carl Banks
On Jan 12, 5:26 am, John Machin wrote: > On Jan 12, 7:29 pm, Carl Banks wrote: > > > > > On Jan 12, 12:32 am, John Machin wrote: > > > > On Jan 12, 12:23 pm, Carl Banks wrote: > > > > > On Jan 9, 6:11 pm, John Machin wrote: > > > > > > On Jan 10, 6:58 am, Carl Banks wrote: > > > > > > I expec

Re: Slow network?

2009-01-12 Thread Laszlo Nagy
Waiting for a response after each send will take longer than doing the sends and then the responses. Have you tried pinging the destination to see how long the round trip takes? Has your friend? My test application listens on 127.0.0.1. gand...@gandalf-desktop:~/Python/Lib/orb/examples/01_

Re: BadZipfile "file is not a zip file"

2009-01-12 Thread webcomm
On Jan 12, 11:53 am, "Chris Mellon" wrote: > On Sat, Jan 10, 2009 at 1:32 PM,webcomm wrote: > > On Jan 9, 7:33 pm, John Machin wrote: > >> It is not impossible for a file with dummy data to have been > >> handcrafted or otherwise produced by a process different to that used > >> for a real-data f

Re: python3.0 MySQLdb

2009-01-12 Thread skip
>> > I need something to connect to a database, preferably mysql, that >> > works in python3.0 please. >> >> And your question is? gert> MySQLdb or something else for python3.0 ? Given that Python 3.0 is so new and so few packages have been ported to it yet, it might be help

Re: python3.0 MySQLdb

2009-01-12 Thread gert
On Jan 12, 8:25 pm, "Daniel Fetchinson" wrote: > > I need something to connect to a database, preferably mysql, that > > works in python3.0 please. > > And your question is? MySQLdb or something else for python3.0 ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Slow network?

2009-01-12 Thread MRAB
Laszlo Nagy wrote: [snip] Here are some more test results: - original example with setblocking(0) and TCP_NODELAY: 130 messages / sec - same example without TCP_NODELAY: 130 messages/sec (I don't understand why?) - same example without setblocking(0): 130 messages/sec (I guess because I'm u

Re: Slow network?

2009-01-12 Thread Laszlo Nagy
You might also want to replace those 'pass' statements when smartqueue is empty or full with time.sleep() to avoid busy waiting. I misunderstood your post, sorry. My smartqueue class has a timeout parameter, and it can block for an item, or raise the Full/Empty exception after timeout exceeded

Re: Slow network?

2009-01-12 Thread Laszlo Nagy
You might also want to replace those 'pass' statements when smartqueue is empty or full with time.sleep() to avoid busy waiting. It won't do busy waiting, because read_str and write_str are using select.select and they will block without using CPU time, until data becomes available to read/wri

Re: Slow network?

2009-01-12 Thread Laszlo Nagy
It is very likely that nodelay is actually hurting you here. Using the select module and doing non-blocking IO will be faster than using threads for this as well. These sockets are non blocking and I'm using select.select indeed. Here is how it is implemented: def read_data(self,size): re

Re: Slow network?

2009-01-12 Thread MRAB
Chris Mellon wrote: On Mon, Jan 12, 2009 at 1:13 PM, Laszlo Nagy wrote: Hi All, To make the long story short, I have a toy version of an ORB being developed, and the biggest problem is slow network speed over TCP/IP. There is an object called 'endpoint' on both sides, with incoming and outgo

efficient interval containment lookup

2009-01-12 Thread Per Freem
hello, suppose I have two lists of intervals, one significantly larger than the other. For example listA = [(10, 30), (5, 25), (100, 200), ...] might contain thousands of elements while listB (of the same form) might contain hundreds of thousands or millions of elements. I want to count how many i

Re: Slow network?

2009-01-12 Thread Chris Mellon
On Mon, Jan 12, 2009 at 1:13 PM, Laszlo Nagy wrote: > > Hi All, > > To make the long story short, I have a toy version of an ORB being > developed, and the biggest problem is slow network speed over TCP/IP. > > There is an object called 'endpoint' on both sides, with incoming and > outgoing messa

Re: python3.0 MySQLdb

2009-01-12 Thread Daniel Fetchinson
> I need something to connect to a database, preferably mysql, that > works in python3.0 please. And your question is? -- Psss, psss, put it down! - http://www.cafepress.com/putitdown -- http://mail.python.org/mailman/listinfo/python-list

Re: trying to modify locals() dictionary

2009-01-12 Thread Albert Hopkins
On Mon, 2009-01-12 at 19:51 +0100, TP wrote: > Hi everybody, > > I try to modify locals() as an exercise. > According to the context (function or __main__), it works differently (see > below). Why? Thanks > > Julien Per the locals() documentation @ http://docs.python.org/library/functions.html

Re: Creating new instances of subclasses.

2009-01-12 Thread J. Clifford Dyer
On Fri, 2009-01-09 at 10:46 -0800, Dennis Lee Bieber wrote: > On Wed, 07 Jan 2009 11:38:29 -0500, "J. Cliff Dyer" > declaimed the following in comp.lang.python: > > > I want to be able to create an object of a certain subclass, depending > > on the argument given to the class constructor. > > >

Re: Problem with -3 switch

2009-01-12 Thread Christian Heimes
> I say again, show me a case of working 2.5 code where prepending u to > an ASCII string constant that is intended to be used in a text context > is actually worth the keystrokes. Eventually you'll learn it the hard way. *sigh* Christian -- http://mail.python.org/mailman/listinfo/python-list

Slow network?

2009-01-12 Thread Laszlo Nagy
Hi All, To make the long story short, I have a toy version of an ORB being developed, and the biggest problem is slow network speed over TCP/IP. There is an object called 'endpoint' on both sides, with incoming and outgoing message queues. This endpoint object has a socket assigned, with n

  1   2   >