Re: python import module question

2013-07-28 Thread Peter Otten
syed khalid wrote: > I am trying to do a "import shogun" in my python script. I can invoke > shogun with a command line with no problem. But I cannot with a python > import statement. > >>invoking python from a command line... > > Syedk@syedk-ThinkPad-T410:~/shogun-2.0.0/src/interfac

Re: RE Module Performance

2013-07-28 Thread Antoon Pardon
Op 27-07-13 20:21, wxjmfa...@gmail.com schreef: Quickly. sys.getsizeof() at the light of what I explained. 1) As this FSR works with multiple encoding, it has to keep track of the encoding. it puts is in the overhead of str class (overhead = real overhead + encoding). In such a absurd way, that

Configuraion to run pyhton script on ubuntu 12.04

2013-07-28 Thread Jaiky
want to run a python script which contains simple form of html on firefox browser , but dont know what should be the configuration on ubuntu 12.04 to run this script i.e cgi configuration My code is ubder in /var/www/cgi-bin/forms__.py #!/usr/bin/env python import webapp2 form ="""

Re: Thread is somehow interfering with a while loop called after the thread is started

2013-07-28 Thread Irmen de Jong
On 28-7-2013 4:29, dan.h.mciner...@gmail.com wrote: > I have a simple scapy + nfqueue dns spoofing script that I want to turn into > a thread within a larger program: > > http://www.bpaste.net/show/HrlfvmUBDA3rjPQdLmdp/ > > Below is my attempt to thread the program above. Somehow, the only way t

Re: Configuraion to run pyhton script on ubuntu 12.04

2013-07-28 Thread Pierre Jaury
Jaiky writes: > want to run a python script which contains simple form of html on firefox > browser , but dont know what should be the configuration on ubuntu 12.04 to > run this script i.e cgi configuration > > > > My code is > ubder > in /var/www/cgi-bin/forms__.py > > > > #!/usr/bin/en

FSR and unicode compliance - was Re: RE Module Performance

2013-07-28 Thread Michael Torrie
On 07/27/2013 12:21 PM, wxjmfa...@gmail.com wrote: > Good point. FSR, nice tool for those who wish to teach > Unicode. It is not every day, one has such an opportunity. I had a long e-mail composed, but decided to chop it down, but still too long. so I ditched a lot of the context, which jmf also

Re: Configuraion to run pyhton script on ubuntu 12.04

2013-07-28 Thread Jaiky
Sir i already tried this "Alias" concept I did the following steps === Step 1: added "ScriptAlias /cgi-bin/ /var/www/cgi-bin/" in /etc/apache2/sites-available/default ==

Re: FSR and unicode compliance - was Re: RE Module Performance

2013-07-28 Thread Chris Angelico
On Sun, Jul 28, 2013 at 4:52 PM, Michael Torrie wrote: > Is my understanding of these things wrong? No, your understanding of those matters is fine. There's just one area you seem to be misunderstanding; you appear to think that jmf actually cares about logical argument. I gave up on that theory

Re: FSR and unicode compliance - was Re: RE Module Performance

2013-07-28 Thread Terry Reedy
On 7/28/2013 11:52 AM, Michael Torrie wrote: 3. UTF-8 and UTF-16 encodings, being variable width encodings, mean that slicing a string would be very very slow, Not necessarily so. See below. and that's unacceptable for the use cases of python strings. I'm assuming you understand big O notat

Re: [Savoynet] G&S Opera Co: Pirates of Penzance

2013-07-28 Thread Chris Angelico
On Sun, Jul 28, 2013 at 6:36 PM, David Patterson wrote: > By the way, Chris, I think the book that Ruth brought on was probably > supposed to be Debretts Peerage. I couldn't see the cover clearly but it > would have been a more logical choice in view of the circumstances. Sure. Makes no differen

Re: FSR and unicode compliance - was Re: RE Module Performance

2013-07-28 Thread Chris Angelico
On Sun, Jul 28, 2013 at 6:36 PM, Terry Reedy wrote: > I posted about a week ago, in response to Chris A., a method by which lookup > for UTF-16 can be made O(log2 k), or perhaps more accurately, > O(1+log2(k+1)), where k is the number of non-BMP chars in the string. > Which is an optimization cho

Re: RE Module Performance

2013-07-28 Thread wxjmfauth
Le dimanche 28 juillet 2013 05:53:22 UTC+2, Ian a écrit : > On Sat, Jul 27, 2013 at 12:21 PM, wrote: > > > Back to utf. utfs are not only elements of a unique set of encoded > > > code points. They have an interesting feature. Each "utf chunk" > > > holds intrisically the character (in fact th

Re: RE Module Performance

2013-07-28 Thread Joshua Landau
On 28 July 2013 09:45, Antoon Pardon wrote: > Op 27-07-13 20:21, wxjmfa...@gmail.com schreef: > >> utf-8 or any (utf) never need and never spend their time >> in reencoding. >> > > So? That python sometimes needs to do some kind of background > processing is not a problem, whether it is garbage c

Re: RE Module Performance

2013-07-28 Thread Chris Angelico
On Sun, Jul 28, 2013 at 7:19 PM, Joshua Landau wrote: > On 28 July 2013 09:45, Antoon Pardon wrote: >> >> Op 27-07-13 20:21, wxjmfa...@gmail.com schreef: >>> >>> utf-8 or any (utf) never need and never spend their time >>> in reencoding. >> >> >> So? That python sometimes needs to do some kind of

sqlite3 version lacks instr

2013-07-28 Thread Joseph L. Casale
I have some queries that utilize instr wrapped by substr but the old version shipped in 2.7.5 doesn't have instr support. Has anyone encountered this and utilized other existing functions within the shipped 3.6.21 sqlite version to accomplish this? Thanks, jlc -- http://mail.python.org/mailman/l

RE: sqlite3 version lacks instr

2013-07-28 Thread Joseph L. Casale
> Has anyone encountered this and utilized other existing functions > within the shipped 3.6.21 sqlite version to accomplish this? Sorry guys, forgot about create_function... -- http://mail.python.org/mailman/listinfo/python-list

Re: RE Module Performance

2013-07-28 Thread MRAB
On 28/07/2013 19:13, wxjmfa...@gmail.com wrote: Le dimanche 28 juillet 2013 05:53:22 UTC+2, Ian a écrit : On Sat, Jul 27, 2013 at 12:21 PM, wrote: > Back to utf. utfs are not only elements of a unique set of encoded > code points. They have an interesting feature. Each "utf chunk" > holds i

Re: RE Module Performance

2013-07-28 Thread Terry Reedy
On 7/28/2013 2:29 PM, Chris Angelico wrote: On Sun, Jul 28, 2013 at 7:19 PM, Joshua Landau wrote: Somewhat off topic, but befitting of the triviality of this thread, do I understand correctly that you are saying garbage collection never causes any noticeable slowdown in real-world circumstanc

RE: sqlite3 version lacks instr

2013-07-28 Thread Peter Otten
Joseph L. Casale wrote: >> Has anyone encountered this and utilized other existing functions >> within the shipped 3.6.21 sqlite version to accomplish this? > > Sorry guys, forgot about create_function... Too late, I already did the demo ;) >>> import sqlite3 >>> db = sqlite3.connect(":memory:"

embedding: how to create an "idle" handler to allow user to kill scripts?

2013-07-28 Thread David M. Cotter
in my C++ app, on the main thread i init python, init threads, then call PyEval_SaveThread(), since i'm not going to do any more python on the main thread. then when the user invokes a script, i launch a preemptive thread (boost::threads), and from there, i have this: static int

Re: FSR and unicode compliance - was Re: RE Module Performance

2013-07-28 Thread wxjmfauth
Le dimanche 28 juillet 2013 17:52:47 UTC+2, Michael Torrie a écrit : > On 07/27/2013 12:21 PM, wxjmfa...@gmail.com wrote: > > > Good point. FSR, nice tool for those who wish to teach > > > Unicode. It is not every day, one has such an opportunity. > > > > I had a long e-mail composed, but deci

Re: RE Module Performance

2013-07-28 Thread wxjmfauth
Le dimanche 28 juillet 2013 21:04:56 UTC+2, MRAB a écrit : > On 28/07/2013 19:13, wxjmfa...@gmail.com wrote: > > > Le dimanche 28 juillet 2013 05:53:22 UTC+2, Ian a écrit : > > >> On Sat, Jul 27, 2013 at 12:21 PM, wrote: > > >> > > >> > Back to utf. utfs are not only elements of a unique set

Re: FSR and unicode compliance - was Re: RE Module Performance

2013-07-28 Thread MRAB
On 28/07/2013 20:23, wxjmfa...@gmail.com wrote: [snip] Compare these (a BDFL exemple, where I'using a non-ascii char) Py 3.2 (narrow build) Why are you using a narrow build of Python 3.2? It doesn't treat all codepoints equally (those outside the BMP can't be stored in one code unit) and, the

Re: FSR and unicode compliance - was Re: RE Module Performance

2013-07-28 Thread Antoon Pardon
Op 28-07-13 21:23, wxjmfa...@gmail.com schreef: Le dimanche 28 juillet 2013 17:52:47 UTC+2, Michael Torrie a écrit : On 07/27/2013 12:21 PM, wxjmfa...@gmail.com wrote: Good point. FSR, nice tool for those who wish to teach Unicode. It is not every day, one has such an opportunity. I had

collections.Counter surprisingly slow

2013-07-28 Thread Roy Smith
I've been doing an informal "intro to Python" lunchtime series for some co-workers (who are all experienced programmers, in other languages). This week I was going to cover list comprehensions, exceptions, and profiling. So, I did a little demo showing different ways to build a dictionary coun

Re: RE Module Performance

2013-07-28 Thread Lele Gaifax
wxjmfa...@gmail.com writes: > Suggestion. Start by solving all these "micro-benchmarks". > all the memory cases. It a good start, no? Since you seem the only one who has this dramatic problem with such micro-benchmarks, that BTW have nothing to do with "unicode compliance", I'd suggest *you* shou

Re: collections.Counter surprisingly slow

2013-07-28 Thread Steven D'Aprano
On Sun, 28 Jul 2013 15:59:04 -0400, Roy Smith wrote: [...] > I'm rather shocked to discover that count() is the slowest > of all! I expected it to be the fastest. Or, certainly, no slower than > default(). > > The full profiler dump is at the end of this message, but the gist of it > is: > > n

Re: FSR and unicode compliance - was Re: RE Module Performance

2013-07-28 Thread Steven D'Aprano
On Sun, 28 Jul 2013 12:23:04 -0700, wxjmfauth wrote: > Do not forget that à la "FSR" mechanism for a non-ascii user is > *irrelevant*. You have been told repeatedly, Python's internals are *full* of ASCII- only strings. py> dir(list) ['__add__', '__class__', '__contains__', '__delattr__', '__del

Re: collections.Counter surprisingly slow

2013-07-28 Thread Roy Smith
In article <51f5843f$0$29971$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > > Why is count() [i.e. collections.Counter] so slow? > > It's within a factor of 2 of test, and 3 of exception or default (give or > take). I don't think that's surprisingly slow. It is for a module whi

Re: RE Module Performance

2013-07-28 Thread Joshua Landau
On 28 July 2013 19:29, Chris Angelico wrote: > On Sun, Jul 28, 2013 at 7:19 PM, Joshua Landau wrote: > > On 28 July 2013 09:45, Antoon Pardon > wrote: > >> > >> Op 27-07-13 20:21, wxjmfa...@gmail.com schreef: > >>> > >>> utf-8 or any (utf) never need and never spend their time > >>> in reencodi

email 8bit encoding

2013-07-28 Thread rurpy
How, using Python-3.3's email module, do I "flatten" (I think that's the right term) a Message object to get utf-8 encoded body with the headers: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit when the message payload was set to a python (unicode) string? -- http://mail.

Re: [Savoynet] G&S Opera Co: Pirates of Penzance

2013-07-28 Thread Ethan Furman
On 07/28/2013 10:57 AM, Chris Angelico wrote: . . . Okay, how did you get confused that this was a Python List question? ;) -- ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: [Savoynet] G&S Opera Co: Pirates of Penzance

2013-07-28 Thread Tim Chase
On 2013-07-28 16:49, Ethan Furman wrote: > On 07/28/2013 10:57 AM, Chris Angelico wrote: > . > . > . > > Okay, how did you get confused that this was a Python List > question? ;) Must have been this ancient thread http://mail.python.org/pipermail/python-list/2006-September/376063.ht

dynamic type returning NameError:

2013-07-28 Thread Tim O'Callaghan
Hi, I hope that this hasn't been asked for the millionth time, so my apologies if it has. I have a base class (BaseClass - we'll call it for this example) with an http call that i would like to inherit into a dynamic class at runtime. We'll call that method in BaseClass; 'request'. I have

Re: dynamic type returning NameError:

2013-07-28 Thread Terry Reedy
On 7/28/2013 9:38 PM, Tim O'Callaghan wrote: Hi, I hope that this hasn't been asked for the millionth time, so my apologies if it has. I have a base class (BaseClass - we'll call it for this example) with an http call that i would like to inherit into a dynamic class at runtime. We'll call t

Re: dynamic type returning NameError:

2013-07-28 Thread Tim O'Callaghan
On Sunday, July 28, 2013 10:51:57 PM UTC-4, Terry Reedy wrote: > On 7/28/2013 9:38 PM, Tim O'Callaghan wrote: > > > Hi, > > > > > > I hope that this hasn't been asked for the millionth time, so my apologies > > if it has. > > > > > > I have a base class (BaseClass - we'll call it for this exa

Re: dynamic type returning NameError:

2013-07-28 Thread Steven D'Aprano
On Sun, 28 Jul 2013 18:38:10 -0700, Tim O'Callaghan wrote: > Hi, > > I hope that this hasn't been asked for the millionth time, so my > apologies if it has. [...] > I hope that this was clear enough, apologies if it wasn't. Clear as mud. > It's late(ish), I'm tired and borderline frustrated :

Re: collections.Counter surprisingly slow

2013-07-28 Thread Serhiy Storchaka
28.07.13 22:59, Roy Smith написав(ла): The input is an 8.8 Mbyte file containing about 570,000 lines (11,000 unique strings). Repeat you tests with totally unique lines. The full profiler dump is at the end of this message, but the gist of it is: Profiler affects execution time. In partic

Re: [Savoynet] G&S Opera Co: Pirates of Penzance

2013-07-28 Thread Chris Angelico
On Mon, Jul 29, 2013 at 12:49 AM, Ethan Furman wrote: > On 07/28/2013 10:57 AM, Chris Angelico wrote: >. >. >. > > Okay, how did you get confused that this was a Python List question? ;) *sigh* Because I still haven't gotten around to switching mail clients to one that has a Reply-Li