Re: please, help with python 3.1

2010-08-03 Thread Chris Rebert
On Mon, Aug 2, 2010 at 11:35 PM, Alan wrote: > Hello List, > Please, can someone at least try this code below in python 3 and report me > back whether it works or not? Because for me this code works in python 2.6 > but not with python 3.1. Thanks! Please specify *in exactly what way* the code is

Re: please, help with python 3.1

2010-08-03 Thread rantingrick
On Aug 3, 2:11 am, Chris Rebert wrote: > On Mon, Aug 2, 2010 at 11:35 PM, Alan wrote: > > Hello List, > > Please, can someone at least try this code below in python 3 and report me > > back whether it works or not? Because for me this code works in python 2.6 > > but not with python 3.1. Thanks!

Re: please, help with python 3.1

2010-08-03 Thread Chris Rebert
-- Forwarded message -- From: Alan Date: Tue, Aug 3, 2010 at 12:25 AM Subject: Re: please, help with python 3.1 To: Chris Rebert Sorry, I will explain. I am using for a task 'find /' expecting this to last longer, usually much longer than 5 sec. If you run the code I sent in pyth

Re: Trying to set a cookie within a python script

2010-08-03 Thread Chris Rebert
2010/8/2 Νίκος : >>On 2 Αύγ, 23:57, Thomas Jollans wrote: > >> So: tripple-check that >> >>  * your file is >>  * Python knows that >>  * the web browser knows that > > Thank you! i used print ''' Content-Type: text/html; charset=UTF-8 / > n''' and it worked. > I'am still pretty confused about th

Re: Trying to run Python 2.7 on Windows 7 and any suggestions on books/websites for "dummies guide to python" type learning

2010-08-03 Thread rantingrick
On Aug 2, 5:32 pm, James Mills wrote: > On Tue, Aug 3, 2010 at 8:07 AM, ben owen wrote: > > Hi everyone, I'm new to this and was needing help with trying to learn/work > > with Python 2.7 on my computer. I'm running Windows 7 and trying to learn > > python programming from an older book from 1999

Re: please, help with python 3.1

2010-08-03 Thread rantingrick
On Aug 3, 2:28 am, Chris Rebert wrote: > -- Forwarded message -- > From: Alan > Date: Tue, Aug 3, 2010 at 12:25 AM > Subject: Re: please, help with python 3.1 > To: Chris Rebert > > Sorry, > I will explain. Well it looks like he forgot to post the traceback! -- http://mail.pyth

Re: constructing and using large lexicon in a program

2010-08-03 Thread Peter Otten
Majdi Sawalha wrote: > I am developing a morphological analyzer that depends on a large lexicon. > i construct a Lexicon class that reades a text file and construct a > dictionary of the lexicon entries. > the other class will use the lexicon class to chech if the word is found > in the lexicon. t

Re: Trying to set a cookie within a python script

2010-08-03 Thread Dave Angel
� wrote: On 2 Αύγ, 23:57, Thomas Jollans wrote: So: tripple-check that * your file is * Python knows that * the web browser knows that Thank you! i used print ''' Content-Type: text/html; charset=F-8 / n''' and it worked. I'am still pretty c

web and standalone access

2010-08-03 Thread S.Selvam
Hi all, I have a case where my application needs to run as a standalone application and also allow web based access. What could the best python framework to implement it. Note : I found Openobject( openerp ) to be of this kind. I hope i can get more ideas here . -- Regards, S.Selvam " I a

Re: web and standalone access

2010-08-03 Thread James Mills
On Tue, Aug 3, 2010 at 6:15 PM, S.Selvam wrote: > I have a case where my application needs to run as a standalone application > and also allow web based access. > > What could the best python framework to implement it. Both CherryPy and circuits.web sport a "single click 'n run" capability using

Re: Why is python not written in C++ ?

2010-08-03 Thread Nobody
On Mon, 02 Aug 2010 17:17:35 -0700, Peter wrote: > But I always used to tell > people - by the time I got a program to compile then I figured 99% of > the bugs were already discovered! Try that with C/C++ or almost any > other language you care to name :-) ML and Haskell are also quite good for t

Re: Performance ordered dictionary vs normal dictionary

2010-08-03 Thread Chris Rebert
On Fri, Jul 30, 2010 at 9:18 PM, Dan Stromberg wrote: > On Wed, Jul 28, 2010 at 11:11 PM, Chris Rebert wrote: >> (You are aware that the "ordered" in OrderedDict means that its keys >> are ordered, and not that, say, a list containing OrderedDicts can be >> sorted, right?) > > > Actually, a coll

Re: Why is python not written in C++ ?

2010-08-03 Thread Nobody
On Mon, 02 Aug 2010 15:18:30 -0700, sturlamolden wrote: >> Has it ever been planned to rewrite in C++ the historical implementation >> (of course in an object oriented design) ? > > OO programming is possible in C. Just take a look at GNOME and GTK. One feature which can't readily be implemente

PIL

2010-08-03 Thread Navid Parvini
Dear All, I want to convert a .png file to .xpm using PIL. I used the following command: Image.open( "t1.png").save("a1.xpm"). But it doesn't work and I could not convert it. Would you please help me and let me know that how can I convert/save .xpm files in PIL. Thank you in advance. Thanks.

Re: Why is python not written in C++ ?

2010-08-03 Thread Chris Rebert
On Tue, Aug 3, 2010 at 1:36 AM, Nobody wrote: > On Mon, 02 Aug 2010 15:18:30 -0700, sturlamolden wrote: >>> Has it ever been planned to rewrite in C++ the historical implementation >>> (of course in an object oriented design) ? >> >> OO programming is possible in C.  Just take a look at GNOME and

Re: Why is python not written in C++ ?

2010-08-03 Thread James Mills
On Tue, Aug 3, 2010 at 6:36 PM, Nobody wrote: > One feature which can't readily be implemented in C is the automatic > clean-up side of the RAII idiom. C is a Turing-Complete Language is it not ? If so, therefore is it not true "anything" can be implemented ? Even the "automated clean-up side of

Re: checking that process binds a port, fuser functionality

2010-08-03 Thread Nobody
On Mon, 02 Aug 2010 23:27:37 +0200, Zdenek Maxa wrote: > I need to start a process (using subprocess.Popen()) and wait until the > new process either fails or successfully binds a specified port. The > fuser command seems to be indented exactly for this purpose. Could > anyone please provided a hi

Re: PIL

2010-08-03 Thread James Mills
On Tue, Aug 3, 2010 at 6:45 PM, Navid Parvini wrote: > I want to convert a .png file to .xpm using PIL. I used the following > command: > Image.open( "t1.png").save("a1.xpm"). But it doesn't work and I could not > convert it. > > Would you please help me and let me know that how can I convert/save

Re: PIL

2010-08-03 Thread Matteo Landi
I don't think yours is a permitted conversion[1]. It seems that PIL supports xpm format only for reading, but I could be wrong. Regards. [1] http://www.daniweb.com/forums/thread260074.html On Tue, Aug 3, 2010 at 10:45 AM, Navid Parvini wrote: > Dear All, > > I want to convert a .png file to .x

Re: PIL

2010-08-03 Thread Chris Rebert
On Tue, Aug 3, 2010 at 1:45 AM, Navid Parvini wrote: > Dear All, > > I want to convert a .png file to .xpm using PIL. I used the following command: > Image.open( "t1.png").save("a1.xpm"). But it doesn't work and I could not > convert it. > > Would you please help me and let me know that how can I

Re: Why is python not written in C++ ?

2010-08-03 Thread Steven D'Aprano
On Tue, 03 Aug 2010 18:48:24 +1000, James Mills wrote: > On Tue, Aug 3, 2010 at 6:36 PM, Nobody wrote: >> One feature which can't readily be implemented in C is the automatic >> clean-up side of the RAII idiom. > > C is a Turing-Complete Language is it not ? > > If so, therefore is it not true

Re: Trying to set a cookie within a python script

2010-08-03 Thread Nik Gr
Στις 3/8/2010 10:39 πμ, ο/η Chris Rebert έγραψε: Please tell me the difference between 3 things. a) Asking Notepad++(my editor) to save all my python scripts as UTF-8 without BOM. That affects what encoding the text file comprising the source code itself is in. What does this practically mea

Re: please, help with python 3.1

2010-08-03 Thread Steven D'Aprano
Hello Alan, I'm sorry, I can't see the code you say you posted. I can't see ANY of your posts, only the replies from Chris Rebert. Are you using Google Groups to post? If so, many people here will have difficulty seeing your posts, as Google Groups is notorious for allowing spammers, and in

Re: Why is python not written in C++ ?

2010-08-03 Thread James Mills
On Tue, Aug 3, 2010 at 7:04 PM, Steven D'Aprano wrote: > True, but Nobody said it can't *readily* be implemented, not that it > can't be. So he did too :) I read that as "really" :/ --James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/pyth

Re: please, help with python 3.1

2010-08-03 Thread Alan Wilter Sousa da Silva
Ok: Here goes the code again and results: from __future__ import print_function import os, subprocess, signal def signal_handler( signum, frame ): print( "PID: %s" % pid ) print( "Timed out! Process %s killed, max exec time (%ss) exceeded" % (pid, timeTol ) ) os.kill( int( pid ), 15

Re: Why is python not written in C++ ?

2010-08-03 Thread John Bokma
Carl Banks writes: > On Aug 1, 6:09 pm, John Bokma wrote: >> Roy Smith writes: >> > In article <4c55fe82$0$9111$426a3...@news.free.fr>, >> >  candide wrote: >> >> >> Python is an object oriented langage (OOL). The Python main >> >> implementation is written in pure and "old" C90. Is it for his

Re: namespaces, scoping and variables

2010-08-03 Thread Jean-Michel Pichavant
rantingrick wrote: On Aug 2, 3:12 pm, Chris Hare wrote: Also you should use 4 space indention and never use tabs. This is the accepted way. Then ask yourself why tabs are still in python 3. Nice troll by the way. JM -- http://mail.python.org/mailman/listinfo/python-list

Re: Why is python not written in C++ ?

2010-08-03 Thread John Bokma
Albert Hopkins writes: > But I wonder if someone has/has tried to write a programming language in > C++ and what were their experiences. The Low Level Virtual Machine (LLVM) is a compiler infrastructure, written in C++, which is designed for compile-time, link-time, run-time, and "idle-tim

Re: Why is python not written in C++ ?

2010-08-03 Thread John Bokma
Michael Torrie writes: > On 08/01/2010 07:09 PM, John Bokma wrote: >>> One thing that comes to mind is that it's much easier to distribute C >>> libraries than C++ libraries. >> >> In the beginning of C++ there were programs that just converted C++ to C >> (frontends). At least that is how the

Re: Why is python not written in C++ ?

2010-08-03 Thread Nobody
On Tue, 03 Aug 2010 18:48:24 +1000, James Mills wrote: >> One feature which can't readily be implemented in C is the automatic >> clean-up side of the RAII idiom. > > C is a Turing-Complete Language is it not ? > > If so, therefore is it not true "anything" can be implemented ? > Even the "autom

Re: Why is python not written in C++ ?

2010-08-03 Thread Paul Rubin
Nobody writes: > One feature which can't readily be implemented in C is the automatic > clean-up side of the RAII idiom. I once did that by having an explicit stack of finalization records linked through the call stack. The "throw" routine would traverse the links to call the finalizers, until i

Re: simple (I hope!) problem

2010-08-03 Thread Jean-Michel Pichavant
samwyse wrote: I'm writing for the Google app engine and have stubbed my toe yet again on a simple obstacle. Non-trivial app engines programs require the import of several modules that aren't normally in my PYTHONPATH. I'd like to be able to test my code outside of the app engine framework. I'v

Re: simple integer subclass

2010-08-03 Thread Andreas Pfrengle
On 3 Aug., 03:22, Carl Banks wrote:> > You are creating an object that differs from a built-in, int, in a > highly misleading way that only makes sense in a very limited context, > and this object's modified behavior gives no clue that it's been > modified in such as way.  (That is, it's not possi

Get name of file from directory into variable

2010-08-03 Thread loial
In a unix shell script I can do something like this to look in a directory and get the name of a file or files into a variable : MYFILE=`ls /home/mydir/JOHN*.xml` Can I do this in one line in python? -- http://mail.python.org/mailman/listinfo/python-list

Re: Get name of file from directory into variable

2010-08-03 Thread Alex Willmer
On Aug 3, 11:21 am, loial wrote: > In a unix shell script I can do something like this to look in a > directory and get the name of a file or files into a variable : > > MYFILE=`ls /home/mydir/JOHN*.xml` > > Can I do this in one line in python? Depends if you count imports. import glob my_files

Re: Get name of file from directory into variable

2010-08-03 Thread Matteo Landi
I suggest you to take a look at walk function inside the os module [1]; IIRC, on the list you would find a discussion on how to create a wrapper for os.walk with support for filters or wildcards. Regards. [1] http://docs.python.org/library/os.html?highlight=os.walk#os.walk On Tue, Aug 3, 2010 at

Re: Get name of file from directory into variable

2010-08-03 Thread loial
On 3 Aug, 11:31, Alex Willmer wrote: > On Aug 3, 11:21 am, loial wrote: > > > In a unix shell script I can do something like this to look in a > > directory and get the name of a file or files into a variable : > > > MYFILE=`ls /home/mydir/JOHN*.xml` > > > Can I do this in one line in python? > >

Re: Get name of file from directory into variable

2010-08-03 Thread Rory Campbell-Lange
On 03/08/10, Alex Willmer (a...@moreati.org.uk) wrote: > On Aug 3, 11:21?am, loial wrote: > > In a unix shell script I can do something like this to look in a > > directory and get the name of a file or files into a variable : > > > > MYFILE=`ls /home/mydir/JOHN*.xml` > > > > Can I do this in one

Re: checking that process binds a port, fuser functionality

2010-08-03 Thread Roy Smith
In article , Nobody wrote: > On Mon, 02 Aug 2010 23:27:37 +0200, Zdenek Maxa wrote: > > > I need to start a process (using subprocess.Popen()) and wait until the > > new process either fails or successfully binds a specified port. > > If you just need to wait until *something* is listening on

Re: Get name of file from directory into variable

2010-08-03 Thread Matteo Landi
Ops I miss the "one line" request, so my previous answer was definitely OT. glob seems to be your solution. On Tue, Aug 3, 2010 at 12:44 PM, Rory Campbell-Lange wrote: > On 03/08/10, Alex Willmer (a...@moreati.org.uk) wrote: >> On Aug 3, 11:21?am, loial wrote: >> > In a unix shell script I can

I GOT $2500 FROM PAYPAL....

2010-08-03 Thread paypal cash
I GOT $2500 FROM PAYPAL At http://2050videos.co.cc i have hidden the PayPal Form link in an image. in that website On Top Side Above search box , click on image and enter your PayPal id And Your name. -- http://mail.python.org/mailman/listinfo/python-list

Re: calling a class method from a menu in a different class

2010-08-03 Thread Chris Hare
No offense taken. I'll get getting the Google Python Style Guide today. I'll package up the code tonight and it to the group. Fortunately ( or unfortunately), it is all in one file right now. On Aug 2, 2010, at 10:31 PM, rantingrick wrote: > > Chris, > > It looks as if you are calling a cl

Re: calling a class method from a menu in a different class

2010-08-03 Thread Chris Hare
Oh and Risk, I know I was calling the class object. class 1 creates the instance object class 2 tries to use the instance object so the problem is how to make class 2 knowledgable of instance object? I guess I could pass the instance object into the class, since class1 creates the instance and

Re: please, help with python 3.1

2010-08-03 Thread Antoine Pitrou
On Tue, 3 Aug 2010 10:28:49 +0100 Alan Wilter Sousa da Silva wrote: > Now with python3.1: > > > time python3.1 timout.py > PID: 27687 > Timed out! Process 27687 killed, max exec time (5s) exceeded > Traceback (most recent call last): > File "

Re: how can I solve this erorr usr/lib/python2.6 : permisson denied

2010-08-03 Thread Mohseniaref
thanks I fix it and change path to bin folder -- http://mail.python.org/mailman/listinfo/python-list

subclassing versus object redefinition

2010-08-03 Thread wheres pythonmonks
Hi! I have a class (supposed to be an abstract base class): In python (as opposed to static languages like C++) I don't seed to subclass the base class, but instead I can simply override the behavior of stub methods and values. Is there a preference between between subclassing (C++ approach) and o

Re: simple integer subclass

2010-08-03 Thread rantingrick
> On Aug 3, 5:15 am, Andreas Pfrengle wrote: > > Seems I end up with your suggestion - if noone else has an idea ;-) START_COUNTING_FROM_HERE = 1 -- http://mail.python.org/mailman/listinfo/python-list

Pydev 1.6.1 Released

2010-08-03 Thread Fabio Zadrozny
Hi All, Pydev 1.6.1 has been released Details on Pydev: http://pydev.org Details on its development: http://pydev.blogspot.com Release Highlights: --- * **Debugger** * **Critical Fix: issue that prevented the debugger from working with Python 3 solved** * Im

cPickle error when caching data

2010-08-03 Thread Benedict Verheyen
Hi i get the following error when trying to set data in the cache of a django application. The error is however a python error as it involves pickling and i can reproduce it in a shell. The error i get is this: cPickle.PicklingError: Can't pickle : attribute lookup management.views.Stats failed

Re: Trying to set a cookie within a python script

2010-08-03 Thread Νίκος
> On 3 Αύγ, 11:10, Dave Angel wrote: > a) a text editor takes keystrokes and cut/paste info and other data, and > produces a stream of (unicode) characters.  It then encodes each of   > those character into one or more bytes and saves it to a file.  You have > to tell Notepad++ how to do that enc

Re: simple integer subclass

2010-08-03 Thread Jean-Michel Pichavant
Andreas Pfrengle wrote: On 3 Aug., 03:22, Carl Banks wrote:> You are creating an object that differs from a built-in, int, in a highly misleading way that only makes sense in a very limited context, and this object's modified behavior gives no clue that it's been modified in such as way. (T

Re: simple integer subclass

2010-08-03 Thread Jean-Michel Pichavant
Jean-Michel Pichavant wrote: Andreas Pfrengle wrote: On 3 Aug., 03:22, Carl Banks wrote:> You are creating an object that differs from a built-in, int, in a highly misleading way that only makes sense in a very limited context, and this object's modified behavior gives no clue that it's been

Re: subclassing versus object redefinition

2010-08-03 Thread Roald de Vries
On Aug 3, 2010, at 2:46 PM, wheres pythonmonks wrote: Hi! I have a class (supposed to be an abstract base class): In python (as opposed to static languages like C++) I don't seed to subclass the base class, but instead I can simply override the behavior of stub methods and values. Is there a pre

Re: Why is python not written in C++ ?

2010-08-03 Thread Grant Edwards
On 2010-08-02, Aahz wrote: > In article , > Peter wrote: >>On Aug 3, 7:42=A0am, Mark Lawrence wrote: >>> On 02/08/2010 00:08, candide wrote: >>> >>> I can't understand why any serious programmer mentions C++. As soon >>> as I read it, I have to rush either to the kitchen to find a bowl to >>> t

Re: Why is python not written in C++ ?

2010-08-03 Thread Grant Edwards
On 2010-08-02, Paul Rubin wrote: > Michael Torrie writes: >> Sometimes, C++ is just the right tool for the job, despite all its >> warts C++'s object semantics (guaranteed destruction, scoping, >> etc) can sometimes work very well when you need the speed of a >> compiled language, but don't

Re: checking that process binds a port, fuser functionality

2010-08-03 Thread Zdenek Maxa
Original Message Subject: Re: checking that process binds a port, fuser functionality From: Roy Smith To: python-list@python.org Date: Tue Aug 03 2010 13:06:27 GMT+0200 (CEST) > In article , > Nobody wrote: > >> On Mon, 02 Aug 2010 23:27:37 +0200, Zdenek Maxa wrote: >> >>> I

Re: subclassing versus object redefinition

2010-08-03 Thread wheres pythonmonks
Roald: First, I must admit, I didn't know I could create an ABC in python. Now I see (http://docs.python.org/library/abc.html). Thank you. I think that the crux of the matter is in points #3, #4, and #5 that you raised: 3) adding stuff to instances is less reusable that adding stuff to (sub)cla

Re: checking that process binds a port, fuser functionality

2010-08-03 Thread Roy Smith
On Aug 3, 10:32 am, Zdenek Maxa wrote: > Yes, but I need a check that certain known process's PID listens on a > defined port. connect() would certainly work, but I may end up > connecting to a different process. Then you need to define your protocol such that the client and server engage in so

Re: cPickle error when caching data

2010-08-03 Thread Peter Otten
Benedict Verheyen wrote: > i get the following error when trying to set data in the cache of a django > application. The error is however a python error as it involves pickling > and i can reproduce it in a shell. > The error i get is this: > cPickle.PicklingError: Can't pickle : > attribute looku

Re: subclassing versus object redefinition

2010-08-03 Thread Roald de Vries
Hi W, On Aug 3, 2010, at 4:38 PM, wheres pythonmonks wrote: I think that the crux of the matter is in points #3, #4, and #5 that you raised: I think #2 is important too: a program is supposed to do what you expect, and I don't expect instantiation of an ABC. On #3: Not clear that all po

Re: cPickle error when caching data

2010-08-03 Thread Benedict Verheyen
On 3/08/2010 17:01, Peter Otten wrote: > You can only pickle instances of classes that are reachable by the import > system as only the qualified name of the class is stored, not the bytecode > to generate it. Move your class out of the function into the global module > scope and you should be

Re: Trying to set a cookie within a python script

2010-08-03 Thread Dave Angel
¯º¿Â wrote: On 3 Αύγ, 11:10, Dave Angel wrote: a) a text editor takes keystrokes and cut/paste info and other data, and produces a stream of (unicode) characters. It then encodes each of those character into one or more bytes and saves it to a file. You have to tell Notepad++ ho

Re: simple integer subclass

2010-08-03 Thread Roald de Vries
Hi Andreas, On Aug 3, 2010, at 1:52 AM, Andreas Pfrengle wrote: I'm trying to define a subclass of int called int1. An int1-object shall behave exactly like an int-object, with the only difference that the displayed value shall be value + 1 (it will be used to display array indices starting at 1

Re: Why is python not written in C++ ?

2010-08-03 Thread Carl Banks
On Aug 3, 2:29 am, John Bokma wrote: > Carl Banks writes: > > On Aug 1, 6:09 pm, John Bokma wrote: > >> Roy Smith writes: > >> > In article <4c55fe82$0$9111$426a3...@news.free.fr>, > >> >  candide wrote: > > >> >> Python is an object oriented langage (OOL). The Python main > >> >> implementati

Re: default behavior

2010-08-03 Thread Ethan Furman
John Posner wrote: On 7/31/2010 1:31 PM, John Posner wrote: Caveat -- there's another description of defaultdict here: http://docs.python.org/library/collections.html#collections.defaultdict ... and it's bogus. This other description claims that __missing__ is a method of defaultdict, not of

Re: Why is python not written in C++ ?

2010-08-03 Thread Ethan Furman
John Bokma wrote: Michael Torrie writes: On 08/01/2010 07:09 PM, John Bokma wrote: One thing that comes to mind is that it's much easier to distribute C libraries than C++ libraries. In the beginning of C++ there were programs that just converted C++ to C (frontends). At least that is how th

Re: Trying to set a cookie within a python script

2010-08-03 Thread Νίκος
>On 3 Αύγ, 18:41, Dave Angel wrote: > > Different encodings equal different ways of storing the data to the > > media, correct? > > Exactly. The file is a stream of bytes, and Unicode has more than 256 > possible characters. Further, even the subset of characters that *do* > take one byte are diff

finding homopolymers in both directions

2010-08-03 Thread Lee Sander
Hi, Suppose I have a string such as this 'aabccefghiiijkr' I would like to print out all the positions that are flanked by a run of symbols. So for example, I would like to the output for the above input as follows: 2 b 1 aa 2 b -1 cc 10 e -1 cc 11 f 1 g 17 h 1 iii 17

Re: Behavior of re.split on empty strings is unexpected

2010-08-03 Thread John Nagle
On 8/2/2010 5:53 PM, samwyse wrote: On Aug 2, 12:34 pm, John Nagle wrote: The regular expression "split" behaves slightly differently than string split: I'm going to argue that it's the string split that's behaving oddly. I tend to agree. It doesn't seem to be possible to get the sam

Re: Why is python not written in C++ ?

2010-08-03 Thread John Nagle
On 8/1/2010 5:36 PM, Roy Smith wrote: In article<4c55fe82$0$9111$426a3...@news.free.fr>, candide wrote: Python is an object oriented langage (OOL). The Python main implementation is written in pure and "old" C90. Is it for historical reasons? C is not an OOL and C++ strongly is. I wonder if

regular expressions and the LOCALE flag

2010-08-03 Thread Baz Walter
the python docs say that re.LOCALE makes certain character classes "dependent on the current locale". here's what i currently see on my system: >>> import re, locale >>> locale.getdefaultlocale() ('en_GB', 'UTF8') >>> locale.getlocale() (None, None) >>> re.findall(r'\w', u'a b c \xe5 \xe6 \xe7'

Re: Trying to set a cookie within a python script

2010-08-03 Thread Dave Angel
¯º¿Â wrote: On 3 Αύγ, 18:41, Dave Angel wrote: Different encodings equal different ways of storing the data to the media, correct? Exactly. The file is a stream of bytes, and Unicode has more than 256 possible characters. Further, even the subset of characters that *do* take one b

Re: Why is python not written in C++ ?

2010-08-03 Thread Benjamin Kaplan
On Tue, Aug 3, 2010 at 10:44 AM, John Nagle wrote: > On 8/1/2010 5:36 PM, Roy Smith wrote: > >> In article<4c55fe82$0$9111$426a3...@news.free.fr>, >> candide wrote: >> >> Python is an object oriented langage (OOL). The Python main >>> implementation is written in pure and "old" C90. Is it for h

Re: finding homopolymers in both directions

2010-08-03 Thread Peter Otten
Lee Sander wrote: > Hi, > Suppose I have a string such as this > 'aabccefghiiijkr' > > I would like to print out all the positions that are flanked by a run > of symbols. > So for example, I would like to the output for the above input as > follows: > > 2 b 1 aa > 2 b -1 cc > 10

Re: Why is python not written in C++ ?

2010-08-03 Thread Paul Rubin
Grant Edwards writes: > There's no computing problem so simple that it can't be solved in a > complex and obtuse manner in C++. > > I know that's true of any language, but from what I've seen over the > years, it "more true" in C++. http://www.willamette.edu/~fruehr/haskell/evolution.html -- htt

Re: regular expressions and the LOCALE flag

2010-08-03 Thread MRAB
Baz Walter wrote: the python docs say that re.LOCALE makes certain character classes "dependent on the current locale". here's what i currently see on my system: >>> import re, locale >>> locale.getdefaultlocale() ('en_GB', 'UTF8') >>> locale.getlocale() (None, None) >>> re.findall(r'\w',

Re: Trying to set a cookie within a python script

2010-08-03 Thread Dotan Cohen
On Tue, Aug 3, 2010 at 18:41, Dave Angel wrote: > I don't understand your wording. Certainly the server launches the python > script, and captures stdout. It then sends that stream of bytes out over > tcp/ip to the waiting browser. You ask when does it become html ? I don't > think the question ha

locale and number formatting.

2010-08-03 Thread Joe Goldthwaite
I've been working with some developers on a project. Our standard number formatting for the entire web site is comma separated with no decimals. Currency is formatted with the dollar sign. This is basically how they did it; import locale def currency(value): return locale.currency(va

Re: Trying to set a cookie within a python script

2010-08-03 Thread MRAB
Dave Angel wrote: ¯º¿Â wrote: On 3 Αύγ, 18:41, Dave Angel wrote: Different encodings equal different ways of storing the data to the media, correct? Exactly. The file is a stream of bytes, and Unicode has more than 256 possible characters. Further, even the subset of characters th

Re: regular expressions and the LOCALE flag

2010-08-03 Thread Baz Walter
On 03/08/10 19:40, MRAB wrote: Baz Walter wrote: the python docs say that re.LOCALE makes certain character classes "dependent on the current locale". re.LOCALE just passes the character to the underlying C library. It really only works on bytestrings which have 1 byte per character. the re

None is negative?

2010-08-03 Thread wheres pythonmonks
I did the google search... I must be blind as I don't see any hits... None is negative in Python? (v2.6) http://www.google.com/search?ie=UTF-8&q=%22none+is+negative%22+python >>> if None < -999.99: print "hi" hi >>> >>> if -999 > None: print "hi" hi >>> Is there a way to have the co

Re: None is negative?

2010-08-03 Thread Benjamin Kaplan
On Tue, Aug 3, 2010 at 1:17 PM, wheres pythonmonks wrote: > > I did the google search... I must be blind as I don't see any hits... > > None is negative in Python?  (v2.6) > > http://www.google.com/search?ie=UTF-8&q=%22none+is+negative%22+python > > >>> if None < -999.99: print "hi" > > hi > >

Re: regular expressions and the LOCALE flag

2010-08-03 Thread MRAB
Baz Walter wrote: On 03/08/10 19:40, MRAB wrote: Baz Walter wrote: the python docs say that re.LOCALE makes certain character classes "dependent on the current locale". re.LOCALE just passes the character to the underlying C library. It really only works on bytestrings which have 1 byte per c

Re: None is negative?

2010-08-03 Thread Mithrandir
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 08/03/2010 01:17 PM, wheres pythonmonks wrote: > I did the google search... I must be blind as I don't see any hits... > > None is negative in Python? (v2.6) > > http://www.google.com/search?ie=UTF-8&q=%22none+is+negative%22+python > if Non

Re: None is negative?

2010-08-03 Thread Grant Edwards
On 2010-08-03, wheres pythonmonks wrote: > I did the google search... I must be blind as I don't see any hits... > > None is negative in Python? (v2.6) Not really. > http://www.google.com/search?ie=UTF-8&q=%22none+is+negative%22+python > if None < -999.99: print "hi" > > hi > >>>

Re: None is negative?

2010-08-03 Thread Ned Deily
In article , wheres pythonmonks wrote: > I did the google search... I must be blind as I don't see any hits... > > None is negative in Python? (v2.6) > > http://www.google.com/search?ie=UTF-8&q=%22none+is+negative%22+python > > >>> if None < -999.99: print "hi" > > hi > >>> > > >>> if

Re: None is negative?

2010-08-03 Thread Grant Edwards
On 2010-08-03, Grant Edwards wrote: > On 2010-08-03, wheres pythonmonks wrote: > >> I did the google search... I must be blind as I don't see any hits... >> >> None is negative in Python? (v2.6) > > Not really. > >> http://www.google.com/search?ie=UTF-8&q=%22none+is+negative%22+python >> > i

Re: None is negative?

2010-08-03 Thread Mithrandir
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 08/03/2010 01:28 PM, Mithrandir wrote: > On 08/03/2010 01:17 PM, wheres pythonmonks wrote: >> I did the google search... I must be blind as I don't see any hits... > >> None is negative in Python? (v2.6) > >> http://www.google.com/search?ie=UTF-8

Re: Trying to set a cookie within a python script

2010-08-03 Thread Dave Angel
MRAB wrote: Dave Angel wrote: ¯º¿Â wrote: On 3 Αύγ, 18:41, Dave Angel wrote: Different encodings equal different ways of storing the data to the media, correct? Exactly. The file is a stream of bytes, and Unicode has more than 256 possible characters. Further, even the subset of character

Re: None is negative?

2010-08-03 Thread Chris Rebert
On Tue, Aug 3, 2010 at 1:29 PM, Grant Edwards wrote: > On 2010-08-03, wheres pythonmonks wrote: > >> I did the google search... I must be blind as I don't see any hits... >> >> None is negative in Python?  (v2.6) > > Not really. > >> http://www.google.com/search?ie=UTF-8&q=%22none+is+negative%22+

Re: None is negative?

2010-08-03 Thread Ethan Furman
Grant Edwards wrote: On 2010-08-03, wheres pythonmonks wrote: I did the google search... I must be blind as I don't see any hits... None is negative in Python? (v2.6) Not really. http://www.google.com/search?ie=UTF-8&q=%22none+is+negative%22+python if None < -999.99: print "hi" hi

Re: None is negative?

2010-08-03 Thread Benjamin Kaplan
On Tue, Aug 3, 2010 at 1:29 PM, Grant Edwards wrote: > On 2010-08-03, wheres pythonmonks wrote: > >> I did the google search... I must be blind as I don't see any hits... >> >> None is negative in Python?  (v2.6) > > Not really. > >> http://www.google.com/search?ie=UTF-8&q=%22none+is+negative%22+

Re: default behavior

2010-08-03 Thread John Posner
On 8/3/2010 12:54 PM, Ethan Furman wrote: I think mentioning how __missing__ plays into all this would be helpful. Perhaps in the first paragraph, after the colon: if a key does not currently exist in a defaultdict object, __missing__ will be called with that key, which in turn will call a "d

Re: default behavior

2010-08-03 Thread Christian Heimes
> So I'd rather not mention __missing__ in the first paragraph, which > describes the functionality provided *by* the defaultdict class. How > about adding this para at the end: > > defaultdict is defined using functionality that is available to *any* > subclass of dict: a missing-key lookup

Re: default behavior

2010-08-03 Thread Ethan Furman
John Posner wrote: On 8/3/2010 12:54 PM, Ethan Furman wrote: I think mentioning how __missing__ plays into all this would be helpful. Perhaps in the first paragraph, after the colon: if a key does not currently exist in a defaultdict object, __missing__ will be called with that key, which in

Re: default behavior

2010-08-03 Thread John Posner
On 8/3/2010 5:47 PM, Christian Heimes wrote: So I'd rather not mention __missing__ in the first paragraph, which describes the functionality provided *by* the defaultdict class. How about adding this para at the end: defaultdict is defined using functionality that is available to *any* sub

Re: Why is python not written in C++ ?

2010-08-03 Thread John Bokma
Carl Banks writes: > On Aug 3, 2:29 am, John Bokma wrote: [..] >> But they call both the C libraries in the same way. > > Go look at the original claim, the one that you responded to. "It's > much easier to distribute C libraries than C++ libraries." Yup, and if I read it correctly the claim

Re: default behavior

2010-08-03 Thread Ethan Furman
John Posner wrote: On 7/31/2010 1:31 PM, John Posner wrote: Caveat -- there's another description of defaultdict here: http://docs.python.org/library/collections.html#collections.defaultdict ... and it's bogus. This other description claims that __missing__ is a method of defaultdict, not of

Re: Why is python not written in C++ ?

2010-08-03 Thread John Bokma
Ethan Furman writes: > John Bokma wrote: >> Michael Torrie writes: >> >>> On 08/01/2010 07:09 PM, John Bokma wrote: > One thing that comes to mind is that it's much easier to > distribute C libraries than C++ libraries. In the beginning of C++ there were programs that just converted

Re: default behavior

2010-08-03 Thread Christian Heimes
> I just went and read the entry that had the bogus claim -- personally, I > didn't see any confusion. I would like to point out the __missing__ is > *not* part of dicts (tested on 2.5 and 2.6 -- don't have 2.7 installed yet). I beg your pardon but you are wrong. __missing__ is available for al

  1   2   >