Re: The opener parameter of Python 3 open() built-in

2012-09-05 Thread Tim Delaney
On 6 September 2012 16:34, Steven D'Aprano < steve+comp.lang.pyt...@pearwood.info> wrote: > On Thu, 06 Sep 2012 00:34:56 +, Antoine Pitrou wrote: > > Monkey-patching globals is not thread-safe: other threads will see your > > modification, which is risky and fragile. > > Isn't that assuming th

Re: is implemented with id ?

2012-09-05 Thread Steven D'Aprano
On Wed, 05 Sep 2012 14:27:44 -0400, Terry Reedy wrote: > On 9/5/2012 8:48 AM, Ramchandra Apte wrote: > > > and "a==True" should be automatically changed into memory comparison. > > I have no idea what that means. I interpret this as meaning that "a == True" should be special-cased by the inte

Re: The opener parameter of Python 3 open() built-in

2012-09-05 Thread Steven D'Aprano
On Thu, 06 Sep 2012 00:34:56 +, Antoine Pitrou wrote: > Chris Angelico gmail.com> writes: >> >> On Wed, Sep 5, 2012 at 5:16 AM, Terry Reedy udel.edu> >> wrote: >> > io.open depends on a function the returns an open file descriptor. >> > opener exposes that dependency so it can be replaced.

Dynamically scheduling Cron Jobs for Python Scripts.

2012-09-05 Thread coldfire
I have a web scrapper script which run every day at 0100 hrs using cron Job over a shell account. Now what I am looking for is to re run the same script. 1> The script goes online to scrape some data including a schedule time for my meeting. I want to re run the script at that schedule time to se

Re: [web] Long-running process: FCGI? SCGI? WSGI?

2012-09-05 Thread Dieter Maurer
Gilles writes: > To write a long-running web application, I'd like to some feedback > about which option to choose. > > Apparently, the choice boilds down to this: > - FastCGI > - SCGI > - WSGI > > It seems like FCGI and SCGI are language-neutral, while WSGI is > Python-specific. > > Besides that

===== Soft Skills Training In Chennai ======

2012-09-05 Thread mike pittenson
Ayus Technologies offers Dot net training in chennai,java/j2ee training in chennai,SEO training in chennai,web designing training in chennai,soft skills training in chennai,Software Testing training in chennai. http://www.ayustechnologies.com/ =

RPython, static type annotations, SafePython project (was: PhD Python & Smalltalk grant possibility (Lille/INRIA))

2012-09-05 Thread Stefan Behnel
Mariano Reingart, 05.09.2012 18:53, on python-announce-list: > Context: Dynamically-typed languages cannot take advantage of static > type information. In this context we would like to study > the benefit of the introduction of static types *annotations* on > library design and general robustness.

Re: Python Interview Questions

2012-09-05 Thread Kushal Kumaran
On Wed, Sep 5, 2012 at 3:11 PM, Stephen Anto wrote: > On Wed, Sep 5, 2012 at 2:10 PM, Kushal Kumaran > wrote: >> >> On Wed, Sep 5, 2012 at 12:20 PM, wrote: >> > On Tuesday, October 30, 2007 11:44:01 PM UTC+5:30, Krypto wrote: >> >> Hi, >> >> >> >> I have used Python for a couple of projects las

Re: The opener parameter of Python 3 open() built-in

2012-09-05 Thread Antoine Pitrou
Chris Angelico gmail.com> writes: > > On Wed, Sep 5, 2012 at 5:16 AM, Terry Reedy udel.edu> wrote: > > io.open depends on a function the returns an open file descriptor. opener > > exposes that dependency so it can be replaced. > > I skimmed the bug report comments but didn't find an answer to

Re: webkit related problems

2012-09-05 Thread Mark Lawrence
On 05/09/2012 23:08, manish gupta wrote: What should I do in order to install Webkit for Official Python (not MacPorts Python) ? INVOKER, from INDIA I'd start with your favourite search engine, type something like "install webkit official python" into the box, hit return, see what comes

Re: Comparing strings from the back?

2012-09-05 Thread Oscar Benjamin
In news.gmane.comp.python.general, you wrote: > On Wed, 05 Sep 2012 16:51:10 +0200, Johannes Bauer wrote: > [...] >>> You are making unjustified assumptions about the distribution of >>> letters in the words. This might be a list of long chemical compounds >>> where the words typically differ only

Re: Python Interview Questions

2012-09-05 Thread Chris Angelico
On Thu, Sep 6, 2012 at 2:40 AM, Ian Kelly wrote: > On Wed, Sep 5, 2012 at 9:34 AM, Chris Angelico wrote: >> On Thu, Sep 6, 2012 at 1:22 AM, Ian Kelly wrote: >>> The lack of an ORDER BY is the least of the problems with that SQL. >>> He's also using LIMIT without OFFSET, so the only thing that th

Language workbench written in python3

2012-09-05 Thread Nestor Arocha
I'm developing a language workbench written in Python. The idea is to create an environment where grammars and translators can interact easily. https://github.com/nesaro/pydsl any comments, feedback or ideas? :) -- http://mail.python.org/mailman/listinfo/python-list

ctypes, strange structures of PKCS11

2012-09-05 Thread Cornelius Kölbel
Hi there, I am trying to use a pkcs11 library (with python 2.7) and address this library with ctypes. Alas, I am neither the python black belt guru and C is not my preferred language. Till now, I do not want to use pykcs11, since I want to keep my dependencies low. I initialized the library, log

Re: python docs search for 'print'

2012-09-05 Thread Walter Hurry
On Wed, 05 Sep 2012 15:03:16 -0400, Terry Reedy wrote: > On 9/5/2012 8:45 AM, Ramchandra Apte wrote: > These ever increasing extra blank lines with each quote are obnoxious. > Consider using a news reader with news.gmane.org instead of google crap. > Or snip heavily. +1. And the duplicated post

Re: python docs search for 'print'

2012-09-05 Thread Terry Reedy
On 9/5/2012 8:45 AM, Ramchandra Apte wrote: On Wednesday, 5 September 2012 15:03:56 UTC+5:30, Terry Reedy wrote: On 9/5/2012 1:22 AM, Ramchandra Apte wrote: On Wednesday, 5 September 2012 09:35:43 UTC+5:30, Terry Reedy wrote: If you do find the right place, you should contribute somethi

Mailergate (was: python docs search for 'print')

2012-09-05 Thread Thomas 'PointedEars' Lahn
Stephen D'Aprano wrote: > On Tue, 04 Sep 2012 20:27:38 +0200, Thomas 'PointedEars' Lahn wrote: >> ¹ The other mess they created (or allowed to be created) is this mashup >>of newsgroup and mailing list, neither of which works properly, > > In what way do they not work properly? Most promine

Re: is implemented with id ?

2012-09-05 Thread Dave Angel
On 09/05/2012 02:27 PM, Terry Reedy wrote: > On 9/5/2012 8:48 AM, Ramchandra Apte wrote: > >> Seeing this thread, I think the is statment should be removed. >> It has a replacement syntax of id(x) == id(y) > > The thread is wrong then. > > If the implementation reuses ids, which CPython does, > is

Re: is implemented with id ?

2012-09-05 Thread Terry Reedy
On 9/5/2012 10:41 AM, Steven D'Aprano wrote: True. In principle, some day there might be a version of Python that runs on some exotic quantum computer where the very concept of "physical address" is meaningless. You mean like the human brain? When people execute Python code, does 0 have an ad

Re: is implemented with id ?

2012-09-05 Thread Terry Reedy
On 9/5/2012 8:48 AM, Ramchandra Apte wrote: Seeing this thread, I think the is statment should be removed. It has a replacement syntax of id(x) == id(y) The thread is wrong then. If the implementation reuses ids, which CPython does, is must be implemented as internal-tem1 = internal-tem2

Re: python docs search for 'print'

2012-09-05 Thread Grant Edwards
On 2012-09-05, Dave Angel wrote: > On 09/05/2012 01:47 PM, Grant Edwards wrote: > >> Making the site's "search" box use Google or somesuch is probably the >> simplest solution. I'm not enough of a web guy to know how to do >> that, but I do know that some sites do handle site search that way. >> >

Re: python docs search for 'print'

2012-09-05 Thread Dave Angel
On 09/05/2012 01:47 PM, Grant Edwards wrote: > On 2012-09-05, Terry Reedy wrote: >> On 9/4/2012 11:22 PM, Ramchandra Apte wrote: >> >>> I was actually planning to write a bug on this. >> If you do, find the right place to submit it. >> bugs.python.org is for issues relating to the cpython reposito

Re: HTMLParser skipping HTML? [newbie]

2012-09-05 Thread Peter Otten
BobAalsma wrote: > [Didn't understand the bit about the kittens, though. How about that?] > > Oops, sorry, found that bit about logging in - asked too soon; still > wonder about the kittens ;) I just wanted to tell you not to mark the end of an if-suite with an "# end if" comment. As soon as yo

Re: python docs search for 'print'

2012-09-05 Thread Grant Edwards
On 2012-09-05, Terry Reedy wrote: > On 9/4/2012 11:22 PM, Ramchandra Apte wrote: > >> I was actually planning to write a bug on this. > > If you do, find the right place to submit it. > bugs.python.org is for issues relating to the cpython repository.' > I fairly sure that the website search code

Re: HTMLParser skipping HTML? [newbie]

2012-09-05 Thread BobAalsma
Op woensdag 5 september 2012 19:23:45 UTC+2 schreef BobAalsma het volgende: > Op woensdag 5 september 2012 14:57:05 UTC+2 schreef BobAalsma het volgende: > > > I'm trying to understand the HTMLParser so I've copied some code from > > http://docs.python.org/library/htmlparser.html?highlight=html#H

Re: HTMLParser skipping HTML? [newbie]

2012-09-05 Thread BobAalsma
Op woensdag 5 september 2012 14:57:05 UTC+2 schreef BobAalsma het volgende: > I'm trying to understand the HTMLParser so I've copied some code from > http://docs.python.org/library/htmlparser.html?highlight=html#HTMLParser and > tried that on my LinkedIn page. > > No errors, but some of the tags

Re: is implemented with id ?

2012-09-05 Thread Dave Angel
On 09/05/2012 12:47 PM, Hans Mulder wrote: > On 5/09/12 17:09:30, Dave Angel wrote: >> But by claiming that id() really means address, and that those addresses >> might move during the lifetime of an object, then the fact that the id() >> functions are not called simultaneously implies that one obj

Re: is implemented with id ?

2012-09-05 Thread Ian Kelly
On Wed, Sep 5, 2012 at 8:13 AM, Steven D'Aprano wrote: > You *cannot* replace is with id() except when the objects are guaranteed > to both be alive at the same time, and even then you *shouldn't* replace > is with id() because that is a pessimation (the opposite of an > optimization -- something

Re: is implemented with id ?

2012-09-05 Thread Hans Mulder
On 5/09/12 17:09:30, Dave Angel wrote: > But by claiming that id() really means address, and that those addresses > might move during the lifetime of an object, then the fact that the id() > functions are not called simultaneously implies that one object might > move to where the other one used to

Re: Python Interview Questions

2012-09-05 Thread Roy Smith
In article , Ian Kelly wrote: > My mistake. I didn't even know there was a two-arg form of LIMIT. > Must be a MySQL thing. :-) What are you talking about? SQL is an ISO Standard. Therefore, all implementations work the same way. Didn't you get the memo? -- http://mail.python.org/mailman/l

Re: Python Interview Questions

2012-09-05 Thread Roy Smith
In article , Ian Kelly wrote: > It's a bit sad that these are touted as answers to interview > questions. I wouldn't hire anybody who gave answers like these. Over time, I've become convinced that most interview questions are crap. The best programming interview questions always start with,

Re: Python Interview Questions

2012-09-05 Thread Ian Kelly
On Wed, Sep 5, 2012 at 9:34 AM, Chris Angelico wrote: > On Thu, Sep 6, 2012 at 1:22 AM, Ian Kelly wrote: >> The lack of an ORDER BY is the least of the problems with that SQL. >> He's also using LIMIT without OFFSET, so the only thing that the >> 'item' argument changes is how many rows are retur

Re: is implemented with id ?

2012-09-05 Thread Tim Chase
On 09/05/12 08:46, Dave Angel wrote: > It's id() which is superfluous. But it's useful for debugging, > and for understanding. While I assiduously work to eschew shadowing most built-in names such as "list" or "str", I do make an exception for "id" because it's *so* useful in code, and the built-

Re: Extract Text Table From File

2012-09-05 Thread Tim Chase
[trimming out a bunch of superfluous text so the thread is actually readable] On 09/05/12 08:08, Ramchandra Apte wrote: > On Monday, 27 August 2012 15:42:14 UTC+5:30, Laszlo Nagy wrote: >> On 2012-08-27 11:53, Huso wrote: >>> I am trying to extract some text table data from a log file >> >> fin =

Re: how can i register the non-default browser with the webbrowser module?

2012-09-05 Thread Mark Lawrence
On 05/09/2012 15:32, Levi Nie wrote: how can i register the non-default browser with the webbrowser module? the case: i want open a site such as "google.com" in ie8 with the python.But my default is chrome. so i want to register a ie8 controller with the webbrowser.register(*name*, *constructor*

Re: Python Interview Questions

2012-09-05 Thread Roy Smith
In article , charvigro...@gmail.com wrote: > Hi Guys, > > Finally I have decided to put best interview question and answers. > > Please visit http://www.f2finterview.com/web/CorePython/ for core python and > http://www.f2finterview.com/web/PythonAdvanced/ for advanced python I was going to co

Re: Comparing strings from the back?

2012-09-05 Thread Steven D'Aprano
On Wed, 05 Sep 2012 16:51:10 +0200, Johannes Bauer wrote: [...] >> You are making unjustified assumptions about the distribution of >> letters in the words. This might be a list of long chemical compounds >> where the words typically differ only in their suffix. It might be a >> list of people with

Re: how can i register the non-default browser with the webbrowser module?

2012-09-05 Thread Peter Otten
Levi Nie wrote: > how can i register the non-default browser with the webbrowser module? > > the case: > i want open a site such as "google.com" in ie8 with the python.But my > default is chrome. > so i want to register a ie8 controller with the > webbrowser.register(*name*, *constructor*[, *inst

Re: Python Interview Questions

2012-09-05 Thread Dave Angel
On 09/05/2012 11:34 AM, Chris Angelico wrote: > On Thu, Sep 6, 2012 at 1:22 AM, Ian Kelly wrote: >> The lack of an ORDER BY is the least of the problems with that SQL. >> He's also using LIMIT without OFFSET, so the only thing that the >> 'item' argument changes is how many rows are returned (all

Re: sockets,threads and interupts

2012-09-05 Thread Bryan
loial wrote: > I have threaded python script that uses sockets to monitor network ports. > > I want to ensure that the socket is closed cleanly in all circumstances. This > includes if the script is killed or interupted in some other way. > > As I understand it signal only works in the main thread

Re: sockets,threads and interupts

2012-09-05 Thread Ramchandra Apte
On Wednesday, 5 September 2012 21:29:12 UTC+5:30, Ramchandra Apte wrote: > On Wednesday, 5 September 2012 18:34:32 UTC+5:30, Chris Angelico wrote: > > > On Wed, Sep 5, 2012 at 10:54 PM, Ramchandra Apte > > wrote: > > > > > > > At least on Linux, if you kill a process using sockets, it takes

Re: sockets,threads and interupts

2012-09-05 Thread Ramchandra Apte
On Wednesday, 5 September 2012 18:34:32 UTC+5:30, Chris Angelico wrote: > On Wed, Sep 5, 2012 at 10:54 PM, Ramchandra Apte > wrote: > > > At least on Linux, if you kill a process using sockets, it takes about 10 > > seconds for socket to be closed. A program should try to close all > > resour

Re: Comparing strings from the back?

2012-09-05 Thread Peter Otten
Oscar Benjamin wrote: > On 5 September 2012 10:48, Peter Otten <__pete...@web.de> wrote: >> def count_common(a, b): [sorry for seriously broken implementation] > This function will return 1 if the first character differs. It does not > count the number of common characters but rather the more r

Re: is implemented with id ?

2012-09-05 Thread Steven D'Aprano
On Wed, 05 Sep 2012 11:09:30 -0400, Dave Angel wrote: > On 09/05/2012 10:41 AM, Steven D'Aprano wrote: [...] >> So, for current day computers at least, it is reasonable to say that "a >> is b" implies that a and b are the same object at a single location. > > You're arguing against something i di

Re: Python Interview Questions

2012-09-05 Thread Chris Angelico
On Thu, Sep 6, 2012 at 1:22 AM, Ian Kelly wrote: > The lack of an ORDER BY is the least of the problems with that SQL. > He's also using LIMIT without OFFSET, so the only thing that the > 'item' argument changes is how many rows are returned (all but one of > which are ignored), not which one is a

Re: Python Interview Questions

2012-09-05 Thread Ian Kelly
On Wed, Sep 5, 2012 at 8:34 AM, Chris Angelico wrote: > I wouldn't go that far. The 'name' parameter, I would expect, would be > a constant. The 'item' parameter, though, is probably not a constant, and it's interpolated just the same. > However, this strikes me as encouraging some really > inef

Re: is implemented with id ?

2012-09-05 Thread Dave Angel
On 09/05/2012 10:41 AM, Steven D'Aprano wrote: > On Wed, 05 Sep 2012 10:00:09 -0400, Dave Angel wrote: > >> On 09/05/2012 09:19 AM, Franck Ditter wrote: >>> Thanks to all, but : >>> - I should have said that I work with Python 3. Does that matter ? - >>> May I reformulate the queston : "a is b" and

Re: Comparing strings from the back?

2012-09-05 Thread Johannes Bauer
On 05.09.2012 16:30, Steven D'Aprano wrote: > Since these are *completely different Ns*, you can't combine them to get > O(N**2 log N) as the overall algorithmic complexity. Doing so is sheer > nonsense. If you state it like this: Yes, you are correct here. > You are making unjustified assumpt

Re: is implemented with id ?

2012-09-05 Thread Steven D'Aprano
On Wed, 05 Sep 2012 10:00:09 -0400, Dave Angel wrote: > On 09/05/2012 09:19 AM, Franck Ditter wrote: >> Thanks to all, but : >> - I should have said that I work with Python 3. Does that matter ? - >> May I reformulate the queston : "a is b" and "id(a) == id(b)" >> both mean : "a et b share the s

Re: Python Interview Questions

2012-09-05 Thread Chris Angelico
On Thu, Sep 6, 2012 at 12:34 AM, Chris Angelico wrote: > However, this strikes me as encouraging some really > inefficient code, like iterating over all the rows in a table with N+1 > queries (one to get the length, then a separate query for each row). Huh. And then I scroll down, and that's prec

Re: Comparing strings from the back?

2012-09-05 Thread Johannes Bauer
On 05.09.2012 04:18, Neil Hodgson wrote: >The memcpy patch was controversial as it broke Adobe Flash which > assumed memcpy was safe like memmove. Adobe Flash was broken before, making an assumption that is not guaranteed by the standard. The patch only showed the problem. Regards, Johannes

Re: Python Interview Questions

2012-09-05 Thread Chris Angelico
On Thu, Sep 6, 2012 at 12:21 AM, Peter Otten <__pete...@web.de> wrote: > charvigro...@gmail.com wrote: > >> Finally I have decided to put best interview question and answers. >> >> Please visit http://***/web/CorePython/ for core python >> and http://***/web/PythonAdvanced/ for advanced python > >

Re: Comparing strings from the back?

2012-09-05 Thread Steven D'Aprano
On Wed, 05 Sep 2012 11:43:08 +0200, Johannes Bauer wrote: > On 05.09.2012 11:24, Johannes Bauer wrote: > >> Consider sorting a large dictionary. Sorting is in O(n log(n)), but >> this assumes O(1) comparisons! If the comparison operation itself were >> in O(n), the total sorting complexity would

how can i register the non-default browser with the webbrowser module?

2012-09-05 Thread Levi Nie
how can i register the non-default browser with the webbrowser module? the case: i want open a site such as "google.com" in ie8 with the python.But my default is chrome. so i want to register a ie8 controller with the webbrowser.register(*name*, *constructor*[, *instance*]). so what does the param

Re: Python Interview Questions

2012-09-05 Thread Peter Otten
charvigro...@gmail.com wrote: > Finally I have decided to put best interview question and answers. > > Please visit http://***/web/CorePython/ for core python > and http://***/web/PythonAdvanced/ for advanced python Hm, are you a reformed PHP programmer who has never heard of sql injection atta

Re: is implemented with id ?

2012-09-05 Thread Steven D'Aprano
On Wed, 05 Sep 2012 05:48:26 -0700, Ramchandra Apte wrote: > Seeing this thread, I think the is statment should be removed. It has a > replacement syntax of id(x) == id(y) A terrible idea. Because "is" is a keyword, it is implemented as a fast object comparison directly in C (for CPython) or Ja

Re: is implemented with id ?

2012-09-05 Thread Dave Angel
Please don't top-post. Now your message is out of order, and if I have to delete the part Benjamin said. On 09/05/2012 09:19 AM, Franck Ditter wrote: > Thanks to all, but : > - I should have said that I work with Python 3. Does that matter ? > - May I reformulate the queston : "a is b" and "id(a)

Re: HTMLParser skipping HTML? [newbie]

2012-09-05 Thread Peter Otten
BobAalsma wrote: > I'm trying to understand the HTMLParser so I've copied some code from http://docs.python.org/library/htmlparser.html?highlight=html#HTMLParser and tried that on my LinkedIn page. > No errors, but some of the tags seem to go missing for no apparent reason - any advice? > I hav

Re: is implemented with id ?

2012-09-05 Thread Hans Mulder
On 5/09/12 15:19:47, Franck Ditter wrote: > Thanks to all, but : > - I should have said that I work with Python 3. Does that matter ? > - May I reformulate the queston : "a is b" and "id(a) == id(b)" > both mean : "a et b share the same physical address". Is that True ? Yes. Keep in mind, thoug

Re: is implemented with id ?

2012-09-05 Thread Dave Angel
On 09/05/2012 08:48 AM, Ramchandra Apte wrote: > On Wednesday, 5 September 2012 14:44:23 UTC+5:30, Steven D'Aprano wrote: >> >> > Seeing this thread, I think the is statment should be removed. > It has a replacement syntax of id(x) == id(y) and "a==True" should be > automatically changed into m

Re: Beginners question

2012-09-05 Thread Dave Angel
On 09/05/2012 04:03 AM, Mark Lawrence wrote: > On 05/09/2012 07:28, charvigro...@gmail.com wrote: >> Hi, >> >> I have attached python interview questions and answers for beginners. >> >> Please visit http://www.f2finterview.com/web/CorePython/ for core >> python and >> >> http://www.f2finterview.co

Re: Comparing strings from the back?

2012-09-05 Thread Oscar Benjamin
On 5 September 2012 10:48, Peter Otten <__pete...@web.de> wrote: > Chris Angelico wrote: > > > On Wed, Sep 5, 2012 at 6:29 PM, Peter Otten <__pete...@web.de> wrote: > >> comparing every pair in a sample of 1000 8-char words > >> taken from '/usr/share/dict/words' > >> > >> head > >> 1: 477222

Re: why did the WindowsError occur?

2012-09-05 Thread Chris Angelico
On Wed, Sep 5, 2012 at 10:51 PM, Ramchandra Apte wrote: > On Wednesday, 5 September 2012 13:21:58 UTC+5:30, Mark Lawrence wrote: >> Because you've done something wrong. If you'd like to tell us what >> you've done to find out where the problem is, we are far more likely to >> help. Please remem

Re: is implemented with id ?

2012-09-05 Thread Franck Ditter
Thanks to all, but : - I should have said that I work with Python 3. Does that matter ? - May I reformulate the queston : "a is b" and "id(a) == id(b)" both mean : "a et b share the same physical address". Is that True ? Thanks, franck In article , Benjamin Kaplan wrote: > On Tue, Sep 4,

Re: Extract Text Table From File

2012-09-05 Thread Ramchandra Apte
On Monday, 27 August 2012 15:42:14 UTC+5:30, Laszlo Nagy wrote: > On 2012-08-27 11:53, Huso wrote: > > > Hi, > > > > > > I am trying to extract some text table data from a log file. I am trying > > different methods, but I don't seem to get anything to work. I am kind of > > new to python as

Re: sockets,threads and interupts

2012-09-05 Thread Chris Angelico
On Wed, Sep 5, 2012 at 10:54 PM, Ramchandra Apte wrote: > At least on Linux, if you kill a process using sockets, it takes about 10 > seconds for socket to be closed. A program should try to close all resources. > OS'es may take a long time to close a unclosed socket automatically. Err, that's

Re: simple client data base

2012-09-05 Thread Ramchandra Apte
On Monday, 3 September 2012 19:42:21 UTC+5:30, Manatee wrote: > Hello all, I am learning to program in python. I have a need to make a > > program that can store, retrieve, add, and delete client data such as > > name, address, social, telephone number and similar information. This > > would be

Re: Is there a way to configure IDLE to use spaces instead of tabs for indenting?

2012-09-05 Thread Ramchandra Apte
On Saturday, 25 August 2012 04:03:52 UTC+5:30, Alex wrote: > I'm new to Python and have been using IDLE 3.2.3 to experiment with > > code as I learn. Despite being configured to use a 4 space indentation > > width, sometimes IDLE's "smart" indentation insists upon using width-8 > > tabs. > >

Re: [2.5.1] Read each line from txt file, replace, and save?

2012-09-05 Thread Gilles
On Sun, 02 Sep 2012 14:04:29 -0400, Terry Reedy wrote: >If you process each line separately, there is no reason to read them all >at once. Use the file as an iterator directly. Since line is already a >string, there is no reason to copy it into a new string. Combining these >two changes with Ma

HTMLParser skipping HTML? [newbie]

2012-09-05 Thread BobAalsma
I'm trying to understand the HTMLParser so I've copied some code from http://docs.python.org/library/htmlparser.html?highlight=html#HTMLParser and tried that on my LinkedIn page. No errors, but some of the tags seem to go missing for no apparent reason - any advice? I have searched extensively f

Re: sockets,threads and interupts

2012-09-05 Thread Ramchandra Apte
On Wednesday, 5 September 2012 11:26:16 UTC+5:30, Dieter Maurer wrote: > loial writes: > > > > > I have threaded python script that uses sockets to monitor network ports. > > > > > > I want to ensure that the socket is closed cleanly in all circumstances. > > This includes if the script is

Re: why did the WindowsError occur?

2012-09-05 Thread Ramchandra Apte
On Wednesday, 5 September 2012 13:21:58 UTC+5:30, Mark Lawrence wrote: > On 05/09/2012 07:30, Levi Nie wrote: > > > my code: > > > import os > > > os.startfile(r'C:\Program Files\Internet Explorer.exe') > > > > > > the error: > > > os.startfile(r'C:\Program Files\Internet Explorer.exe') > >

Re: is implemented with id ?

2012-09-05 Thread Ramchandra Apte
On Wednesday, 5 September 2012 14:44:23 UTC+5:30, Steven D'Aprano wrote: > On Wed, 05 Sep 2012 08:30:31 +0200, Franck Ditter wrote: > > > > > Hi ! > > > a is b <==> id(a) == id(b) in builtin classes. Is that true ? > > > > Not just for builtin classes, for any objects, provided that they ar

Re: python docs search for 'print'

2012-09-05 Thread Ramchandra Apte
On Wednesday, 5 September 2012 15:03:56 UTC+5:30, Terry Reedy wrote: > On 9/5/2012 1:22 AM, Ramchandra Apte wrote: > > > On Wednesday, 5 September 2012 09:35:43 UTC+5:30, Terry Reedy wrote: > > > > >> If you do find the right place, you should contribute something to an > > >> improvement. T

[web] Long-running process: FCGI? SCGI? WSGI?

2012-09-05 Thread Gilles
Hello To write a long-running web application, I'd like to some feedback about which option to choose. Apparently, the choice boilds down to this: - FastCGI - SCGI - WSGI It seems like FCGI and SCGI are language-neutral, while WSGI is Python-specific. Besides that, how to make an informed choic

Re: Why derivated exception can not be pickled ?

2012-09-05 Thread Mathieu Courtois
Hello, The simple example works fine using __reduce__: class MyError(Exception): def __init__(self, arg): self.arg = arg def __reduce__(self): return (MyError, (self.arg, )) -- http://mail.python.org/mailman/listinfo/python-list

Re: Comparing strings from the back?

2012-09-05 Thread Peter Otten
Chris Angelico wrote: > On Wed, Sep 5, 2012 at 6:29 PM, Peter Otten <__pete...@web.de> wrote: >> comparing every pair in a sample of 1000 8-char words >> taken from '/usr/share/dict/words' >> >> head >> 1: 477222 >> 2: 18870 ** >> ...

Re: Comparing strings from the back?

2012-09-05 Thread Johannes Bauer
On 05.09.2012 11:24, Johannes Bauer wrote: > Consider sorting a large dictionary. Sorting is in O(n log(n)), but this > assumes O(1) comparisons! If the comparison operation itself were in > O(n), the total sorting complexity would be O(n^2 log(n)), which is > definitely false. Most comparisons wi

Re: python docs search for 'print'

2012-09-05 Thread Terry Reedy
On 9/5/2012 1:22 AM, Ramchandra Apte wrote: On Wednesday, 5 September 2012 09:35:43 UTC+5:30, Terry Reedy wrote: If you do find the right place, you should contribute something to an improvement. The current search performance is not a secret, so mere complaints are useless. I was thinking

Re: Comparing strings from the back?

2012-09-05 Thread Johannes Bauer
On 04.09.2012 23:59, Chris Angelico wrote: >> n = (256 / 255) * (1 - 256 ^ (-c)) >> >> where n is the average number of character comparisons and c. The >> rationale as follows: The first character has to be compared in any >> case. The second with a probability of 1/256, the third with 1/(256^2)

Re: Comparing strings from the back?

2012-09-05 Thread Johannes Bauer
On 04.09.2012 20:07, Steven D'Aprano wrote: > A reasonable, conservative assumption is to calculate the largest > possible value of the average for random strings. That largest value > occurs when the alphabet is as small as possible, namely two characters. > In practice, strings come from a lar

Re: is implemented with id ?

2012-09-05 Thread Steven D'Aprano
On Wed, 05 Sep 2012 08:30:31 +0200, Franck Ditter wrote: > Hi ! > a is b <==> id(a) == id(b) in builtin classes. Is that true ? Not just for builtin classes, for any objects, provided that they are alive at the same time. There is no guarantee whether IDs will be re-used. Some versions of Pyth

Re: Comparing strings from the back?

2012-09-05 Thread Andrew Artajos
a random idea: you could compare strings by their hashes.. print hash("randomstring") == hash("randomstring") print hash("randomstring") == hash("randoMstring") -- -- http://mail.python.org/mailman/listinfo/python-list

Re: How to tell people to ask questions the smart way

2012-09-05 Thread Andrew Artajos
Stack Overflow has a nice guideline on how to ask a question. http://stackoverflow.com/questions/ask/advice? -- -- http://mail.python.org/mailman/listinfo/python-list

Re: Why derivated exception can not be pickled ?

2012-09-05 Thread Mathieu Courtois
Thanks for your reply On Wednesday, September 5, 2012 8:02:55 AM UTC+2, Dieter Maurer wrote: > > The pickle interface is actually more complex and there are several > > ways an object can ensure picklability. For example, there is > > also a "__reduce__" method. I suppose, that "Exception" def

Re: Python Interview Questions

2012-09-05 Thread Kushal Kumaran
On Wed, Sep 5, 2012 at 12:20 PM, wrote: > On Tuesday, October 30, 2007 11:44:01 PM UTC+5:30, Krypto wrote: >> Hi, >> >> I have used Python for a couple of projects last year and I found it >> extremely useful. I could write two middle size projects in 2-3 months >> (part time). Right now I am a b

Re: Comparing strings from the back?

2012-09-05 Thread Chris Angelico
On Wed, Sep 5, 2012 at 6:29 PM, Peter Otten <__pete...@web.de> wrote: > comparing every pair in a sample of 1000 8-char words > taken from '/usr/share/dict/words' > > head > 1: 477222 > 2: 18870 ** > ... Not understanding this. What are

Re: Comparing strings from the back?

2012-09-05 Thread Peter Otten
Roy Smith wrote: > There's been a bunch of threads lately about string implementations, and > that got me thinking (which is often a dangerous thing). > > Let's assume you're testing two strings for equality. You've already > done the obvious quick tests (i.e they're the same length), and you're

Re: How to tell people to ask questions the smart way

2012-09-05 Thread Mark Lawrence
On 05/09/2012 08:00, Andreas Perstinger wrote: On 05.09.2012 01:05, Ben Finney wrote: Andreas Perstinger writes: On 04.09.2012 11:34, Paolo wrote: > how do I know if a JTextField has the focus? > thank to all Look there: http://www.catb.org/esr/faqs/smart-questions.html#forum That is an un

Re: Beginners question

2012-09-05 Thread Mark Lawrence
On 05/09/2012 07:28, charvigro...@gmail.com wrote: Hi, I have attached python interview questions and answers for beginners. Please visit http://www.f2finterview.com/web/CorePython/ for core python and http://www.f2finterview.com/web/PythonAdvanced/ for advanced python The first question f

Re: why did the WindowsError occur?

2012-09-05 Thread Mark Lawrence
On 05/09/2012 07:30, Levi Nie wrote: my code: import os os.startfile(r'C:\Program Files\Internet Explorer.exe') the error: os.startfile(r'C:\Program Files\Internet Explorer.exe') WindowsError: [Error 2] : 'C:\\Program Files\\Internet Explorer.exe' Because you've done something wrong. If yo

Re: Error 32 - Broken Pipe . Please Help!!

2012-09-05 Thread Mark Lawrence
On 05/09/2012 06:33, Dennis Lee Bieber wrote: On Tue, 4 Sep 2012 20:40:57 -0700 (PDT), Ramchandra Apte declaimed the following in gmane.comp.python.general: *Please* make your variable names more descriptive. No kidding... I haven't seen such cryptic names since 1972 -- an era when

Re: How to tell people to ask questions the smart way

2012-09-05 Thread Andreas Perstinger
On 05.09.2012 01:05, Ben Finney wrote: Andreas Perstinger writes: On 04.09.2012 11:34, Paolo wrote: > how do I know if a JTextField has the focus? > thank to all Look there: http://www.catb.org/esr/faqs/smart-questions.html#forum That is an unhelpful response. So we have to agree to disag