Re: unicode + xml

2009-09-07 Thread Stefan Behnel
Laurent Luce wrote: > Can someone confirm that the issue here is I need to encode the xml data > using: > # encode as UTF-8 > utf8_string = xml.encode( 'utf-8' ) > and then post it to the server. Well, since you declared it to be UTF-8, it must be UTF-8 encoded. However, your question seems to i

Re: using python interpreters per thread in C++ program

2009-09-07 Thread I V
On Mon, 07 Sep 2009 19:22:17 -0700, ganesh wrote: > My application is a TCP server having multiple client connectons. C++ > PTHREADS are for each connected socket and the message received on the > socket is evaluated by python functions. If I use only one process level Do you have to use threads?

Re: zip a huge file into multiple small ones

2009-09-07 Thread Chris Rebert
> On Mon, Sep 7, 2009 at 5:31 PM, Chris Rebert wrote: >> On Mon, Sep 7, 2009 at 4:57 AM, Chris Withers >> wrote: >> > krishna chaitanya wrote: >> >> I am new to dealing with zip files in python. >> >> I have a huge file which i need to zip and send as an attachment >> >> through >> >> email. >> >>

Re: simple string question

2009-09-07 Thread Niklas Norrthon
On 8 Sep, 05:39, Steven D'Aprano wrote: > On Mon, 07 Sep 2009 01:54:09 -0700, Niklas Norrthon wrote: > > Others have answered how to replace '\\n' with '\n'. For a more general > > approach which will handle all string escape sequences allowed in python > > (including '\xdd' and similar), python's

Re: unicode + xml

2009-09-07 Thread Laurent Luce
Can someone confirm that the issue here is I need to encode the xml data using: # encode as UTF-8 utf8_string = xml.encode( 'utf-8' ) and then post it to the server. Laurent - Original Message From: Laurent Luce To: Mark Tolonen ; python-list@python.org Sent: Monday, September 7, 2009

Re: unicode + xml

2009-09-07 Thread Laurent Luce
The xml data is generated on Windows (python 2.6.2) and sent using a post request to a Django server. The django server is running on Ubuntu server with python 2.6.2. The post data is passed to minidom for parsing. Laurent - Original Message From: Mark Tolonen To: python-list@python

Re: zip a huge file into multiple small ones

2009-09-07 Thread krishna chaitanya
Can i automate this process of uploading the zip file into a http server and getting the public url for that? On Mon, Sep 7, 2009 at 5:31 PM, Chris Rebert wrote: > On Mon, Sep 7, 2009 at 4:57 AM, Chris Withers > wrote: > > krishna chaitanya wrote: > >> > >> I am new to dealing with zip files i

Re: Smallest float different from 0.0?

2009-09-07 Thread Steven D'Aprano
On Mon, 07 Sep 2009 08:23:58 -0700, Mark Dickinson wrote: > There's sys.float_info.min: > import sys sys.float_info > sys.float_info(max=1.7976931348623157e+308, max_exp=1024, > max_10_exp=308, min=2.2250738585072014e-308, min_exp=-1021, > min_10_exp=-307, dig=15, mant_dig=53, epsilon=2

Re: First release of pyfsevents

2009-09-07 Thread Aahz
In article , wrote: >On 12:57 am, a...@pythoncraft.com wrote: >>In article >46f3-9a03-46f7125f5...@r5g2000yqi.googlegroups.com>, >>Nicolas Dumazet wrote: >>> >>>kqueue has the limitation that kern.kq_calloutmax is usually set >>>at 4096. Meaning that one could not use this on a big (Mercurial)

Re: unicode + xml

2009-09-07 Thread Mark Tolonen
"Laurent Luce" wrote in message news:255473.44957...@web54203.mail.re2.yahoo.com... Hello, I am trying to do the following: - read list of folders in a specific directory: os.listdir() - some folders have Japanese characters - post list of folders as xml to a web server: I used content-type

Re: simple string question

2009-09-07 Thread jwither
"ryles" wrote in message news:b96be200-9762-4f92-bd0d-9be076bcd...@y20g2000vbk.googlegroups.com... > >> There's probably a more general method covering all the escape >> sequences, but for just \n: >> >> your_string = your_string.replace("\\n", "\n") > > py> s = "hello\\r\\n" > py> s > 'hello\\r

Re: simple string question

2009-09-07 Thread Steven D'Aprano
On Mon, 07 Sep 2009 01:54:09 -0700, Niklas Norrthon wrote: > Others have answered how to replace '\\n' with '\n'. For a more general > approach which will handle all string escape sequences allowed in python > (including '\xdd' and similar), python's eval can be used: eval can do so much more tha

Re: Q on explicitly calling file.close

2009-09-07 Thread Gabriel Genellina
En Sun, 06 Sep 2009 21:20:52 -0300, Stephen Hansen escribió: On Sun, Sep 6, 2009 at 4:31 PM, r wrote: On Sep 6, 1:14 pm, "Jan Kaliszewski" wrote: > 05-09-2009 r wrote: > > i find the with statement (while quite useful in general > > practice) is not a "cure all" for situations that need a

Re: Noddy with submodules?

2009-09-07 Thread Gabriel Genellina
En Mon, 07 Sep 2009 18:55:11 -0300, Torsten Mohr escribió: So i'd like to write a python module in C (which i did before some times). But i'm not sure how i can create a module in a way that i can later do: import measurement import measurement.adc import measurement.adc.channels import mea

Re: Smallest float different from 0.0?

2009-09-07 Thread Steven D'Aprano
On Mon, 07 Sep 2009 08:23:58 -0700, Mark Dickinson wrote: > On Sep 7, 3:47 pm, kj wrote: >> Is there some standardized way (e.g. some "official" module of such >> limit constants) to get the smallest positive float that Python will >> regard as distinct from 0.0? >> >> TIA! >> >> kj > > There's

Re: How to refer to data files without hardcoding paths?

2009-09-07 Thread Gabriel Genellina
En Sun, 06 Sep 2009 10:44:38 -0300, Timothy Madden escribió: Matthew Wilson wrote: When a python package includes data files like templates or images, what is the orthodox way of referring to these in code? I also came across pkg_resources, and that seems to work, but I don't think I underst

Re: Class variable inheritance

2009-09-07 Thread Chris Rebert
On Mon, Sep 7, 2009 at 7:21 PM, Henry 'Pi' James wrote: > I've just found out that a subclass shares the class variables of its > superclass until it's instantiated for the first time, but not any > more afterwards: > > Python 3.1 (r31:73574, Jun 26 2009, 20:21:35) [MSC v.1500 32 bit > (Intel)] on

Re: What python can NOT do?

2009-09-07 Thread Steven D'Aprano
On Tue, 08 Sep 2009 00:09:26 +, Albert van der Horst wrote: >>Existing Python implementations don't give you direct access to >>hardware, and bit-manipulation has a lot of overhead in Python. >>Numerical > > Surely you don't mean that >0x17 & 0xAD > has more overhead than >17 + 123 >

Re: Class variable inheritance

2009-09-07 Thread Steven D'Aprano
On Mon, 07 Sep 2009 19:21:28 -0700, Henry 'Pi' James wrote: > I've just found out that a subclass shares the class variables String variables are strings. Int variables are ints. Float variables are floats. List variables are lists. Class variables are classes. Classes are first-class obje

Re: Import Problem - Please help

2009-09-07 Thread newb.py
On Sep 7, 6:55 pm, Ned Deily wrote: > In article > <8119a298-4660-4680-b460-0924c9baa...@e4g2000prn.googlegroups.com>, > >  "newb.py" wrote: > > On Sep 7, 5:40 pm, "newb.py" wrote: > > > I am trying to learn NLP with Python and am getting the following > > > error when trying to do an import sta

Re: using python interpreters per thread in C++ program

2009-09-07 Thread ganesh
My application is a TCP server having multiple client connectons. C++ PTHREADS are for each connected socket and the message received on the socket is evaluated by python functions. If I use only one process level python interpreter, then every thread has to lock the GIL & so blocking the other thr

Class variable inheritance

2009-09-07 Thread Henry 'Pi' James
I've just found out that a subclass shares the class variables of its superclass until it's instantiated for the first time, but not any more afterwards: Python 3.1 (r31:73574, Jun 26 2009, 20:21:35) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more inf

Re: First release of pyfsevents

2009-09-07 Thread exarkun
On 12:57 am, a...@pythoncraft.com wrote: In article 46f3-9a03-46f7125f5...@r5g2000yqi.googlegroups.com>, Nicolas Dumazet wrote: On Sep 3, 10:33=A0pm, a...@pythoncraft.com (Aahz) wrote: I'm curious why you went with FSEvents rather than kqueue. My company discovered that FSEvents is rather co

Re: Query screen resolution?

2009-09-07 Thread Warpcat
> If it's a GUI app, you ask the GUI toolkit which you're using. Heh, I suppose you're right :) -- http://mail.python.org/mailman/listinfo/python-list

Re: possible attribute-oriented class

2009-09-07 Thread Ken Newton
On Mon, Sep 7, 2009 at 6:02 PM, Jan Kaliszewski wrote: ... > > I think it depends how often people need to implement such boiler-plate > code for themselves. Now I see that this thread is not very popular, so > indeed maybe you are right... Though it'd be nice to have OOTB such > a factory in `coll

Re: Import Problem - Please help

2009-09-07 Thread Ned Deily
In article <8119a298-4660-4680-b460-0924c9baa...@e4g2000prn.googlegroups.com>, "newb.py" wrote: > On Sep 7, 5:40 pm, "newb.py" wrote: > > I am trying to learn NLP with Python and am getting the following > > error when trying to do an import statement: > > > > >>> import nltk > > >>> import re

Re: using python interpreters per thread in C++ program

2009-09-07 Thread Grant Edwards
On 2009-09-07, Mark Hammond wrote: > Sorry, my mistake, I misread the original - using multiple > Python processes does indeed have a GIL per process. I was > referring to the 'multiple interpreters in one process' > feature of Python which is largely deprecated, but if used, > all 'interpreters

Re: SPAM

2009-09-07 Thread URneedless
In article , TBK says... > >On Sep 7, 5:37=A0pm, MrBally wrote: >> On Sep 7, 8:31=A0pm, Kevin Katovic >> wrote: >> >> > Downloadhttp://centraltits.blogspot.com/2009/09/where-can-beginner-star= >t-inve... >> > Free videos high resolution photos and much more. =A0You know what to >> > do! Free Down

SPAM

2009-09-07 Thread TBK
On Sep 7, 5:37 pm, MrBally wrote: > On Sep 7, 8:31 pm, Kevin Katovic > wrote: > > > Downloadhttp://centraltits.blogspot.com/2009/09/where-can-beginner-start-inve... > > Free videos high resolution photos and much more.  You know what to > > do! Free Downloads! > > Sold! Thanks everyone. spam --

Re: IDE for python similar to visual basic

2009-09-07 Thread r
On Sep 7, 6:56 pm, Albert van der Horst wrote: > In article , > > Nobody   wrote: > >On Sun, 30 Aug 2009 10:48:24 -0700, r wrote: > > >> I think a point and click GUI builder (although some may disagree) is > >> actually detrimental to your programming skills. The ability to > >> visualize the GUI

Re: possible attribute-oriented class

2009-09-07 Thread Jan Kaliszewski
08-09-2009 o 02:15:10 Steven D'Aprano wrote: On Mon, 7 Sep 2009 09:37:35 am Jan Kaliszewski wrote: 06-09-2009 o 20:20:21 Ethan Furman wrote: > ... I love being able to type > >current_record.full_name == last_record.full_name > > instead of > >current_record['full_name'] == last_re

Re: First release of pyfsevents

2009-09-07 Thread Aahz
In article , Nicolas Dumazet wrote: >On Sep 3, 10:33=A0pm, a...@pythoncraft.com (Aahz) wrote: >> >> I'm curious why you went with FSEvents rather than kqueue. My company >> discovered that FSEvents is rather coarse-grained: it only tells you that >> there has been an event within a directory, it

unicode + xml

2009-09-07 Thread Laurent Luce
Hello, I am trying to do the following: - read list of folders in a specific directory: os.listdir() - some folders have Japanese characters - post list of folders as xml to a web server: I used content-type 'text/xml' and I use '' to start the xml data. - on the server side (Django), I get the

Re: Import Problem - Please help

2009-09-07 Thread newb.py
On Sep 7, 5:40 pm, "newb.py" wrote: > I am trying to learn NLP with Python and am getting the following > error when trying to do an import statement: > > >>> import nltk > >>> import re > >>> from nltk_lite.utilities import re_show > > Traceback (most recent call last): >   File "", line 1, in >

Import Problem - Please help

2009-09-07 Thread newb.py
I am trying to learn NLP with Python and am getting the following error when trying to do an import statement: >>> import nltk >>> import re >>> from nltk_lite.utilities import re_show Traceback (most recent call last): File "", line 1, in ImportError: No module named nltk_lite.utilities I hav

Re: **** Sweet Teen TITS!! BOOBS VIDEOS HI RES PHOTOS !!!

2009-09-07 Thread MrBally
On Sep 7, 8:31 pm, Kevin Katovic wrote: > Downloadhttp://centraltits.blogspot.com/2009/09/where-can-beginner-start-inve... > Free videos high resolution photos and much more.  You know what to > do! Free Downloads! Sold! Thanks everyone. -- http://mail.python.org/mailman/listinfo/python-list

**** Sweet Teen TITS!! BOOBS VIDEOS HI RES PHOTOS !!!

2009-09-07 Thread Kevin Katovic
Download http://centraltits.blogspot.com/2009/09/where-can-beginner-start-investing-and.html Free videos high resolution photos and much more. You know what to do! Free Downloads! -- http://mail.python.org/mailman/listinfo/python-list

Re: How do I post to the wxPython mailing list?

2009-09-07 Thread Neil Hodgson
PythonAB: > I dont want to register with a google account, > is there any way to use a non-gmail account? A Google account does not mean you have to use gmail. The Google account is used to handle your interaction with Google services and can be used in conjunction with arbitrary email account

expy 0.1.3 released!

2009-09-07 Thread Yingjie Lan
Hi, This is to announce the release of expy 0.1.3 Now this release support class members/fields besides instance members/fields of extension types. What is expy? -- expy is an expressway to extend Python! For more details on expy: http://expy.sf.net/ Thanks! Yingjie --

Re: Flowcharting in Python?

2009-09-07 Thread David Boddie
On Tuesday 08 September 2009 00:09, Grant Edwards wrote: > Have you looked at Skencil (nee Sketch)? It's a > vector/object-oriented drawing program written in Python: > > http://www.skencil.org/ > > It's not really optimized for flowcharts or block diagrams > (IIRC, it doens't have any concep

Re: Windows binaries of python in debug mode

2009-09-07 Thread Gabriel Genellina
En Mon, 07 Sep 2009 06:32:29 -0300, Gabriel Rossetti escribió: I am looking for a version of python 2.5.x compiled for windows in debug mode, but I can't find this, does anyone have a link or have a version that he/she can send me? Short answer: build it yourself. Note that you'll requir

Re: using python interpreters per thread in C++ program

2009-09-07 Thread Mark Hammond
On 8/09/2009 9:16 AM, Grant Edwards wrote: On 2009-09-07, Mark Hammond wrote: CPython's GIL means that multithreading on multiple processors/cores has limitations. Each interpreter has its own GIL, so processor-intensive applications work better using the multiprocessing module than with the t

Re: using python interpreters per thread in C++ program

2009-09-07 Thread Grant Edwards
On 2009-09-07, Mark Hammond wrote: >> CPython's GIL means that multithreading on multiple >> processors/cores has limitations. Each interpreter has its own >> GIL, so processor-intensive applications work better using the >> multiprocessing module than with the threading module. > > I believe you

Re: Windows, CreateThread

2009-09-07 Thread Gary Herron
Torsten Mohr wrote: Hi, in a python C module i may need to create a Thread to do some background observations / calculations. Are there any problems with Python doing something like this? Is there some special support on sharing data? I guess i can't call any Python functions from the threa

Re: how to edit .wsgi file extebtions with IDLE on windows

2009-09-07 Thread gert
On Sep 4, 6:07 am, "Gabriel Genellina" wrote: > En Sat, 29 Aug 2009 20:29:43 -0300, gert escribió: > > > > > On Aug 29, 11:16 pm, "Gabriel Genellina" > > wrote: > >> En Sat, 29 Aug 2009 17:14:14 -0300, gert   > >> escribió: > >> > On Aug 29, 9:31 pm, Chris Rebert wrote: > >> >> On Sat, Aug 29,

Re: What python can NOT do?

2009-09-07 Thread Albert van der Horst
In article <0022052b$0$2930$c3e8...@news.astraweb.com>, Steven D'Aprano wrote: >On Fri, 28 Aug 2009 15:37:46 -0700, qwe rty wrote: > >> i know that an interpreted language like python > >Languages are neither interpreted nor compiled. *Implementations* are >interpreted or compiled. Thanks for a

Re: IDE for python similar to visual basic

2009-09-07 Thread Albert van der Horst
In article , Nobody wrote: >On Sun, 30 Aug 2009 10:48:24 -0700, r wrote: > >> I think a point and click GUI builder (although some may disagree) is >> actually detrimental to your programming skills. The ability to >> visualize the GUI only from the source code as you read it, is as >> important

Re: using python interpreters per thread in C++ program

2009-09-07 Thread Benjamin Kaplan
On Mon, Sep 7, 2009 at 6:31 PM, Mark Hammond wrote: > On 7/09/2009 10:50 PM, MRAB wrote: >> >> sturlamolden wrote: >>> >>> On 7 Sep, 13:53, ganesh wrote: >>> I need to use these to get the proper concurrency in my multi-threaded application without any synchronization mechanisms. >>> >>>

Re: using python interpreters per thread in C++ program

2009-09-07 Thread Mark Hammond
On 7/09/2009 10:50 PM, MRAB wrote: sturlamolden wrote: On 7 Sep, 13:53, ganesh wrote: I need to use these to get the proper concurrency in my multi-threaded application without any synchronization mechanisms. Why will multiple interpreters give you better concurrency? You can have more than

Re: How do I post to the wxPython mailing list?

2009-09-07 Thread PythonAB
On 7 sep 2009, at 22:51, mma...@gmx.net wrote: On Mon, 7 Sep 2009 13:04:39 -0400 Philip Semanchuk wrote: Did you subscribe to the mailing list before sending a message to it? I did not subscribe the gmane account when I tried out posting via gmane. I am pretty sure that I already subscrib

Windows, CreateThread

2009-09-07 Thread Torsten Mohr
Hi, in a python C module i may need to create a Thread to do some background observations / calculations. Are there any problems with Python doing something like this? Is there some special support on sharing data? I guess i can't call any Python functions from the thread, correct? Thanks fo

Re: How do I post to the wxPython mailing list?

2009-09-07 Thread Grant Edwards
On 2009-09-07, wrote: >> > However, I always get an error message back when using gmane. >> >> Which is ??? > > I pasted the e-mail that I received upon posting via the gmane > interface below. >> * You may need to join the group before being allowed to post. That probably means you need to

Scheduling algorithm: Suggestions?

2009-09-07 Thread Allen Fowler
Hello, I have a batch of "rpc style" calls that I must make to an external server via HTTP in a multi threaded fashion. (Return vales must be saved.) Problem is, I need to throttle the rate at which I do this. Each HTTP call takes between 0.2 and several seconds to complete. I need to contr

Re: Flowcharting in Python?

2009-09-07 Thread Grant Edwards
On 2009-09-07, Justin wrote: > Does anyone know of any code or projects around that are > written in Python or can be used by Python to write a > flowcharting application? Have you looked at Skencil (nee Sketch)? It's a vector/object-oriented drawing program written in Python: http://www.ske

Noddy with submodules?

2009-09-07 Thread Torsten Mohr
Hi, i want to write a Python module that interfaces a DLL that we use in the office to do some measurement. So i'd like to write a python module in C (which i did before some times). But i'm not sure how i can create a module in a way that i can later do: import measurement import measurement.

Re: How do I post to the wxPython mailing list?

2009-09-07 Thread mmanns
On Mon, 7 Sep 2009 22:51:47 +0200 mma...@gmx.net wrote: > On Mon, 7 Sep 2009 13:04:39 -0400 > Philip Semanchuk wrote: > > > Did you subscribe to the mailing list before sending a message to > > it? > > I did not subscribe the gmane account when I tried out posting via > gmane. > > I am pretty

Re: How do I post to the wxPython mailing list?

2009-09-07 Thread mmanns
On Mon, 7 Sep 2009 13:04:39 -0400 Philip Semanchuk wrote: > Did you subscribe to the mailing list before sending a message to it? I did not subscribe the gmane account when I tried out posting via gmane. I am pretty sure that I already subscribed to the group in the past. Nevertheless, I subsc

Re: How do I post to the wxPython mailing list?

2009-09-07 Thread mmanns
On Mon, 07 Sep 2009 16:06:11 -0400 Terry Reedy wrote: > mma...@gmx.net wrote: > > Hi > > > > Since I have been told in this group to post wxPython related > > topics in the wxPython-users mailing list instead of here, I just > > tried doing that. > > > > However, I always get an error message b

Re: Multiple inheritance - How to call method_x in InheritedBaseB from method_x in InheritedBaseA?

2009-09-07 Thread Carl Banks
On Sep 6, 10:48 pm, The Music Guy wrote: > Sorry, that last code had a typo in it: > > #!/usr/bin/python > > def main(): >     foox = FooX() >     fooy = FooY() >     fooz = FooZ() > >     foox.method_x("I", "AM", "X") >     print >     fooy.method_x("ESTOY", "Y", "!") >     print >     fooz.metho

Re: How do I post to the wxPython mailing list?

2009-09-07 Thread Terry Reedy
mma...@gmx.net wrote: Hi Since I have been told in this group to post wxPython related topics in the wxPython-users mailing list instead of here, I just tried doing that. However, I always get an error message back when using gmane. Which is ??? -- http://mail.python.org/mailman/listinfo/pyt

Re: The future of Python immutability

2009-09-07 Thread Paul Rubin
John Nagle writes: > Right. Tracking mutablity and ownership all the way down without > making the language either restrictive or slow is tough. > > In multi-thread programs, though, somebody has to be clear on who owns > what. I'm trying to figure out a way for the language, rather tha

Re: Module for Fisher's exact test?

2009-09-07 Thread Mark Dickinson
On Sep 7, 3:50 am, gb345 wrote: > Before I roll my own, is there a good Python module for computing > the Fisher's exact test stastics on 2 x 2 contingency tables? Not in the standard library, certainly. Have you tried SciPy and RPy? -- Mark -- http://mail.python.org/mailman/listinfo/python-li

Re: Flowcharting in Python?

2009-09-07 Thread Stef Mientki
Justin wrote: Hi guys, Does anyone know of any code or projects around that are written in Python or can be used by Python to write a flowcharting application? I haven't been able to find any, but the closest thing I have come across is FlowchartPython which allows you to code in Python from flow

Re: HTTPS on Twisted

2009-09-07 Thread exarkun
On 07:20 pm, koranth...@gmail.com wrote: On Sep 6, 7:53�pm, koranthala wrote: Hi, � �For a financial application, �I am creating a python tool which uses HTTPS to transfer the data from client to server. Now, everything works perfectly, since the SSL support comes free with Twisted. � �I have o

Re: HTTPS on Twisted

2009-09-07 Thread koranthala
On Sep 6, 7:53 pm, koranthala wrote: > Hi, >    For a financial application,  I am creating a python tool which > uses HTTPS to transfer the data from client to server. Now, everything > works perfectly, since the SSL support comes free with Twisted. >    I have one problem though. As an upgrade,

Re: Math Notations, Computer Languages, and the “F orm” in Formalism

2009-09-07 Thread Xah Lee
2009-09-07 On Sep 5, 7:41 am, slawekk wrote: > > Theorem provers > > such as OCaml (HOL, Coq), Mizar does math formalism as a foundation, > > also function as a generic computer language, but lacks abilities as a > > computer algebra system or math notation representation. > > Isabelle's presenta

Re: The future of Python immutability

2009-09-07 Thread John Nagle
Graham Breed wrote: John Nagle wrote: In the beginning, strings, tuples, and numbers were immutable, and everything else was mutable. That was simple enough. But over time, Python has acquired more immutable types - immutable sets and immutable byte arrays. Each of these is a special cas

Re: How do I post to the wxPython mailing list?

2009-09-07 Thread Che M
On Sep 7, 12:50 pm, mma...@gmx.net wrote: > Hi > > Since I have been told in this group to post wxPython related topics in > the wxPython-users mailing list instead of here, I just tried doing > that. > > However, I always get an error message back when using gmane. > Mailing directly, there is no

Re: Validation in RPC call?

2009-09-07 Thread Terry Reedy
Phillip B Oldham wrote: I'm building an RPC service, and I need to validate the input and provide informative error messages to users. What would be the best way to do this? Simple `if` statements each raising a custom exception? `assert` statements inside a try/except block to "translate" the as

Re: Smallest float different from 0.0?

2009-09-07 Thread Mark Dickinson
On Sep 7, 5:08 pm, kj wrote: > Hmmm.  This close-to-the-metal IEEE stuff make a "HERE BE DRAGONS!" > alarms go off in my head...  (What's up with that correction by 1 > to sys.float_info.mant_dig?  Or, probably equivalently, why would > sys.float_info.min_exp (-1021) be off by 1 relative to log2 o

Re: Something confusing about non-greedy reg exp match

2009-09-07 Thread Duncan Booth
"gburde...@gmail.com" wrote: > If I do this: > > import re > a=re.search(r'hello.*?money', 'hello how are you hello funny money') > > I would expect a.group(0) to be "hello funny money", since .*? is a > non-greedy match. But instead, I get the whole sentence, "hello how > are you hello funny

Re: beginner's python help

2009-09-07 Thread Niklas Norrthon
On 6 Sep, 09:00, Maggie wrote: > code practice: > > test = open ("test.txt", "r") > readData = test.readlines() > #set up a sum > sum = 0; > for item in readData: >         sum += int(item) > print sum > > test file looks something like this: > > 34 > 23 > 124 > 432 > 12 > >>> sum(map(int, open('

Re: How do I post to the wxPython mailing list?

2009-09-07 Thread Philip Semanchuk
On Sep 7, 2009, at 12:52 PM, mma...@gmx.net wrote: Hi Since I have been told in this group to post wxPython related topics in the wxPython-users mailing list instead of here, I just tried doing that. However, I always get an error message back when using gmane. Mailing directly, there is n

How do I post to the wxPython mailing list?

2009-09-07 Thread mmanns
Hi Since I have been told in this group to post wxPython related topics in the wxPython-users mailing list instead of here, I just tried doing that. However, I always get an error message back when using gmane. Mailing directly, there is no error message but the message does not appear in the lis

How do I post to the wxPython mailing list?

2009-09-07 Thread mmanns
Hi Since I have been told in this group to post wxPython related topics in the wxPython-users mailing list instead of here, I just tried doing that. However, I always get an error message back when using gmane. Mailing directly, there is no error message but the message does not appear in the lis

Flowcharting in Python?

2009-09-07 Thread Justin
Hi guys, Does anyone know of any code or projects around that are written in Python or can be used by Python to write a flowcharting application? I haven't been able to find any, but the closest thing I have come across is FlowchartPython which allows you to code in Python from flowcharts, which is

Re: Smallest float different from 0.0?

2009-09-07 Thread kj
In Mark Dickinson writes: >The smallest positive subnormal value >is usually 2**-1074. If you want something that would still work >if Python ever switched to using IEEE 754 binary128 format (or some >other IEEE 754 format), then >sys.float_info.min * 2**(1-sys.float_info.mant_dig) Hmmm. Th

Re: [Guppy-pe-list] An iteration idiom (Was: Re: loading files containing multiple dumps)

2009-09-07 Thread Chris Withers
Sverker Nilsson wrote: I hope the new loadall method as I wrote about before will resolve this. def loadall(self,f): ''' Generates all objects from an open file f or a file named f''' if isinstance(f,basestring): f=open(f) while True: yield self.load(f) It would be

Re: Smallest float different from 0.0?

2009-09-07 Thread kj
In Mark Dickinson writes: >On Sep 7, 3:47=A0pm, kj wrote: >> Is there some standardized way (e.g. some "official" module of such >> limit constants) to get the smallest positive float that Python >> will regard as distinct from 0.0? >> >> TIA! >> >> kj >There's sys.float_info.min: impor

Smallest float different from 0.0?

2009-09-07 Thread Xavier Ho
This topic came up before. =] See below. Not sure how 'standardised' this is, though. Double precision: >>> import struct >>> struct.unpack('d', struct.pack('Q', 1))[0] 4.9406564584124654e-324 Float precision: >>> struct.unpack('f', struct.pack('L', 1))[0] 1.4012984643248171e-45 Cheers, Xavier

Re: Smallest float different from 0.0?

2009-09-07 Thread Mark Dickinson
On Sep 7, 3:47 pm, kj wrote: > Is there some standardized way (e.g. some "official" module of such > limit constants) to get the smallest positive float that Python > will regard as distinct from 0.0? > > TIA! > > kj There's sys.float_info.min: >>> import sys >>> sys.float_info sys.float_info(ma

Re: Smallest float different from 0.0?

2009-09-07 Thread Diez B. Roggisch
Paul McGuire wrote: > On Sep 7, 9:47 am, kj wrote: >> Is there some standardized way (e.g. some "official" module of such >> limit constants) to get the smallest positive float that Python >> will regard as distinct from 0.0? >> >> TIA! >> >> kj > > You could find it for yourself: > for i

Re: Smallest float different from 0.0?

2009-09-07 Thread Paul McGuire
On Sep 7, 9:47 am, kj wrote: > Is there some standardized way (e.g. some "official" module of such > limit constants) to get the smallest positive float that Python > will regard as distinct from 0.0? > > TIA! > > kj You could find it for yourself: >>> for i in range(400): ...if 10**-i == 0:

Validation in RPC call?

2009-09-07 Thread Phillip B Oldham
I'm building an RPC service, and I need to validate the input and provide informative error messages to users. What would be the best way to do this? Simple `if` statements each raising a custom exception? `assert` statements inside a try/except block to "translate" the assertion errors into someth

Smallest float different from 0.0?

2009-09-07 Thread kj
Is there some standardized way (e.g. some "official" module of such limit constants) to get the smallest positive float that Python will regard as distinct from 0.0? TIA! kj -- http://mail.python.org/mailman/listinfo/python-list

Re: simple string question

2009-09-07 Thread D'Arcy J.M. Cain
On Mon, 7 Sep 2009 15:29:23 +1000 "jwither" wrote: > Given a string (read from a file) which contains raw escape sequences, > (specifically, slash n), what is the best way to convert that to a parsed > string, where the escape sequence has been replaced (specifically, by a > NEWLINE token)? I

Re: Something confusing about non-greedy reg exp match

2009-09-07 Thread Paul McGuire
On Sep 6, 11:23 pm, Ben Finney wrote: > George Burdell writes: > > I want to find every occurrence of "money," and for each > > occurrence, I want to scan back to the first occurrence > > of "hello." How can this be done? > > By recognising the task: not expression matching, but lexing and > pars

Re: using python interpreters per thread in C++ program

2009-09-07 Thread sturlamolden
On 7 Sep, 14:50, MRAB wrote: > CPython's GIL means that multithreading on multiple processors/cores has > limitations. Each interpreter has its own GIL, so processor-intensive > applications work better using the multiprocessing module than with the > threading module. We incur a 200x speed-pena

Re: using python interpreters per thread in C++ program

2009-09-07 Thread MRAB
sturlamolden wrote: On 7 Sep, 13:53, ganesh wrote: I need to use these to get the proper concurrency in my multi-threaded application without any synchronization mechanisms. Why will multiple interpreters give you better concurrency? You can have more than one thread in the same interpreter.

Re: using python interpreters per thread in C++ program

2009-09-07 Thread sturlamolden
On 7 Sep, 13:17, Ulrich Eckhardt wrote: > Quoting from above: "The GIL is global to the process". So no, it is NOT > private to each thread which means "python" isn't either. > > At least that is my understanding of the issue. Strictly speaking, the GIL is global to the Python DLL, not the proce

Re: beginner's python help

2009-09-07 Thread Esmail
Maggie wrote: code practice: test = open ("test.txt", "r") readData = test.readlines() #set up a sum sum = 0; Hi Maggie, I see you have already gotten a lot of useful help. One additional suggestion would be to use a different variable name other than 'sum' as sum is a Python built-in functio

Re: using python interpreters per thread in C++ program

2009-09-07 Thread sturlamolden
On 7 Sep, 13:53, ganesh wrote: > I need to use these to get the proper concurrency in my multi-threaded > application without any synchronization mechanisms. Why will multiple interpreters give you better concurrency? You can have more than one thread in the same interpreter. Here is the API ex

Re: zip a huge file into multiple small ones

2009-09-07 Thread Chris Rebert
On Mon, Sep 7, 2009 at 4:57 AM, Chris Withers wrote: > krishna chaitanya wrote: >> >> I am new to dealing with zip files in python. >> I have a huge file which i need to zip and send as an attachment through >> email. >> My email restrictions are not allowing me to send it in one go. >> Is there a

Re: httplib incredibly slow :-(

2009-09-07 Thread Chris Withers
Dieter Maurer wrote: Chris Withers writes on Thu, 13 Aug 2009 08:20:37 +0100: ... I've already established that the file downloads in seconds with [something else], so I'd like to understand why python isn't doing the same and fix the problem... A profile might help to understand what the ti

Re: zip a huge file into multiple small ones

2009-09-07 Thread Chris Withers
krishna chaitanya wrote: I am new to dealing with zip files in python. I have a huge file which i need to zip and send as an attachment through email. My email restrictions are not allowing me to send it in one go. Is there a way to split this file into multiple zip files, so that i can mail t

Re: using python interpreters per thread in C++ program

2009-09-07 Thread ganesh
Actually, I modified my program to have a single shared Py-interpreter across all threads to test the usage of GIL. So, I did Py_Initialize in main() function and only called that python function in different threads. But this is not the way I want to use interpreters in my code. I am looking for

Re: Something confusing about non-greedy reg exp match

2009-09-07 Thread MRAB
George Burdell wrote: On Sep 6, 10:06 pm, "Mark Tolonen" wrote: wrote in message news:f98a6057-c35f-4843-9efb-7f36b05b6...@g19g2000yqo.googlegroups.com... If I do this: import re a=re.search(r'hello.*?money', 'hello how are you hello funny money') I would expect a.group(0) to be "hello fun

Re: using python interpreters per thread in C++ program

2009-09-07 Thread Ulrich Eckhardt
ganesh wrote: >> Did you remeber to acquire the GIL? The GIL is global to the process > > No, I did not use GIL. > > -- Why do we need to use GIL even though python is private to each > thread? Quoting from above: "The GIL is global to the process". So no, it is NOT private to each thread which

Re: using python interpreters per thread in C++ program

2009-09-07 Thread Graham Dumpleton
On Sep 7, 6:47 pm, ganesh wrote: > On Sep 7, 3:41 pm, Graham Dumpleton > wrote: > > > On Sep 7, 3:42 pm, sturlamolden wrote: > > interpreters. The simplified GIL state API you mentioned only works > > for threads operating in the main (first) interpreter created within > > the process. > > I mod

Re: The future of Python immutability

2009-09-07 Thread Graham Breed
John Nagle wrote: In the beginning, strings, tuples, and numbers were immutable, and everything else was mutable. That was simple enough. But over time, Python has acquired more immutable types - immutable sets and immutable byte arrays. Each of these is a special case. Immutabil

  1   2   >