Re: images on the web

2008-06-19 Thread Matt Nordhoff
Matt Nordhoff wrote: > chris wrote: >> I'm creating a data plot and need to display the image to a web page. >> What's the best way of doing this without having to save the image to >> disk? I already have a mod_python script that outputs the data in >> tabular format, but I haven't been able to fi

Re: images on the web

2008-06-19 Thread Matt Nordhoff
chris wrote: > I'm creating a data plot and need to display the image to a web page. > What's the best way of doing this without having to save the image to > disk? I already have a mod_python script that outputs the data in > tabular format, but I haven't been able to find anything on adding a > g

Re: Regular expression

2008-06-19 Thread Sallu
On Jun 20, 10:58 am, Soltys <[EMAIL PROTECTED]> wrote: > Hi, > Your post is not about re, but about encoding, next time > be more careful when choosing topic for your post! > Did you check what pep0263 says about encoding? > One of the first thins it says is: > > "(...) > Defining the Encoding > Py

Re: Regular expression

2008-06-19 Thread Soltys
Hi, Your post is not about re, but about encoding, next time be more careful when choosing topic for your post! Did you check what pep0263 says about encoding? One of the first thins it says is: "(...) Defining the Encoding Python will default to ASCII as standard encoding if no other encodin

Regular expression

2008-06-19 Thread Sallu
Hi All, here i have on textbox in which i want to restrict the user to not enter the 'acent character' like ( é ) i wrote the program import re value="this is Praveen" #value = 'riché gerry' if(re.search(r"^[A-Za-z0-9]*$",value)): print "Not allowed accent character" else: print "Valid" outpu

RE: Python as a Testing Language - TTCN-3 Comparison

2008-06-19 Thread Saravanan Shanmugham (sarvi)
Well, looks like someone did such a comparison just recently. Just FYI PDF at the link below http://www.site.uottawa.ca/~bernard/A%20comparison%20between%20ttcn-3%20 and%20python%20v%2011.pdf Comparing TTCN-3 with raw python as they have done is not fair. But even then some of the comparisons m

Re: How do i : Python Threads + KeyboardInterrupt exception

2008-06-19 Thread Brendon Costa
> If only the main thread can receive KeyboardInterrupt, is there any > reason why you couldn't move the functionality of the Read thread into > the main thread? It looks like it's not doing any work, just waiting > for the Proc thread to finish. > > You could start the Proc thread, do the current

images on the web

2008-06-19 Thread chris
I'm creating a data plot and need to display the image to a web page. What's the best way of doing this without having to save the image to disk? I already have a mod_python script that outputs the data in tabular format, but I haven't been able to find anything on adding a generated image. -- http

An idiom for code generation with exec

2008-06-19 Thread eliben
Hello, In a Python program I'm writing I need to dynamically generate functions[*] and store them in a dict. eval() can't work for me because a function definition is a statement and not an expression, so I'm using exec. At the moment I came up with the following to make it work: def build_func(a

Re: Simple and safe evaluator

2008-06-19 Thread Aahz
In article <[EMAIL PROTECTED]>, Simon Forman <[EMAIL PROTECTED]> wrote: > >FWIW, I got around to implementing a function that checks if a string >is safe to evaluate (that it consists only of numbers, operators, and >"(" and ")"). Here it is. :) What's safe about "1000 ** 1000"? -- Aahz

Re: python/ruby question..

2008-06-19 Thread Aahz
In article <[EMAIL PROTECTED]>, Giampaolo Rodola' <[EMAIL PROTECTED]> wrote: >On 19 Giu, 18:49, [EMAIL PROTECTED] (Aahz) wrote: >> In article <[EMAIL PROTECTED]>, >> Matt Nordhoff =A0<[EMAIL PROTECTED]> wrote: >> >>>You're supposed to use the subprocess module. >> >> Really? =A0Sez who? >> >> $ pyt

Re: Pattern Matching Over Python Lists

2008-06-19 Thread Paddy
On Jun 20, 1:44 am, Chris <[EMAIL PROTECTED]> wrote: > Thanks for your help. Those weren't quite what I was looking for, but > I ended up figuring it out on my own. Turns out you can actually > search nested Python lists using simple regular expressions. Strange? How do you match nested '[' ... ']

Re: At long last...

2008-06-19 Thread Dan Bishop
On Jun 19, 9:24 pm, Carl Banks <[EMAIL PROTECTED]> wrote: > On Jun 19, 10:17 pm, Terry Reedy <[EMAIL PROTECTED]> wrote: > > > Carl Banks wrote: > > > Tuples will have an index method in Python 2.6. > > > > I promise I won't indiscriminately use tuples for homogenous data. > > > Honest.  Scout's hon

20-6-2008 –walkin,IT FRESHER,IT EXP OPENINGS

2008-06-19 Thread careerbirds
20-6-2008 –walkin,IT FRESHER,IT EXP OPENINGS http://www.hotjobseeker.com/ * Oracle Apps Techno Functional Consultant http://www.hotjobseeker.com/ * J2EE TECHNICAL ASSOCIATES AT PROKARMA AT HYDERABAD http://www.hotjobseeker.com/ * BEA-Weblogic-Application Server Admin http://www.hotjo

Re: Hamming Distance

2008-06-19 Thread godavemon
Great thanks! On Jun 19, 5:37 pm, Matimus <[EMAIL PROTECTED]> wrote: > On Jun 19, 4:27 pm, godavemon <[EMAIL PROTECTED]> wrote: > > > > > I need to calculate the Hamming Distance of two integers. The hamming > > distance is the number of bits in two integers that don't match. I > > thought there

Re: Hamming Distance

2008-06-19 Thread godavemon
Awesome! Thanks a lot. On Jun 19, 5:00 pm, Mensanator <[EMAIL PROTECTED]> wrote: > On Jun 19, 6:27 pm, godavemon <[EMAIL PROTECTED]> wrote: > > > > > I need to calculate the Hamming Distance of two integers. The hamming > > distance is the number of bits in two integers that don't match. I > >

Re: Python-3.0b1 build fails on Linux : _gestalt

2008-06-19 Thread Benjamin
On Jun 19, 5:07 am, Helmut Jarausch <[EMAIL PROTECTED]> wrote: > Hi, > > trying to build Python-3.0b1 on my Gentoo Linux box fails with > > Failed to find the necessary bits to build these modules: > _gestalt > > Looking at setup.py it seems that module '_gestalt' > is only needed on Darwin but my

Re: At long last...

2008-06-19 Thread Carl Banks
On Jun 19, 10:17 pm, Terry Reedy <[EMAIL PROTECTED]> wrote: > Carl Banks wrote: > > Tuples will have an index method in Python 2.6. > > > I promise I won't indiscriminately use tuples for homogenous data. > > Honest. Scout's honor. Cross my heart. > > Use them as you want. This change came about

Re: At long last...

2008-06-19 Thread Terry Reedy
Carl Banks wrote: Tuples will have an index method in Python 2.6. I promise I won't indiscriminately use tuples for homogenous data. Honest. Scout's honor. Cross my heart. Use them as you want. This change came about because .index was included in the 3.0 Sequence ABC (abstract base clas

RE: python/ruby question..

2008-06-19 Thread bruce
hey guys... i managed to solve what i was attempting.. my goal was rather simple, to be able to have a python script, call a ruby app, and be able to return a value from the ruby (child) app to the parent.. blocking/unblocking wasn't on my radar for now. ultimately, my goal is to have an app on

Re: Simple Python implementation of bag/multiset

2008-06-19 Thread Terry Reedy
MRAB wrote: While another thread is talking about an ordered dict, I thought I'd try a simple implementation of a bag/multiset in Python. Comments/ suggestions welcome, etc. class bag(object): I would prefer a logical rather than alphs order to the methods. Certainly, starting with __init__

Re: advanced listcomprehenions?

2008-06-19 Thread Terry Reedy
Duncan Booth wrote: Mark Wooding <[EMAIL PROTECTED]> wrote: This is still inelegant, though. We can glue the results mod 3 and 5 together using the Chinese Remainder Theorem and working mod 15 instead. For example, [['Fizz', 'FizzBuzz', False, None, 'Buzz'][(pow(i, 4, 15) + 1)%7] or s

Re: python/ruby question..

2008-06-19 Thread Paul McGuire
On Jun 18, 10:33 pm, "bruce" <[EMAIL PROTECTED]> wrote: > hi... > > can someone point me to where/how i would go about calling a ruby app from a > python app, and having the python app being able to get a returned value > from the ruby script. > I'm betting that Ruby is similar to Python in that a

Re: Simple Python class questions

2008-06-19 Thread Terry Reedy
John Dann wrote: Let's say I define the class in a module called comms.py. The class isn't really going to inherit from any other class (except presumably in the most primitive base-class sense, which is presumably automatic and implicit in using the class keyword). Let's call the class serial

Re: Hamming Distance

2008-06-19 Thread Raymond Hettinger
Non-recursive, 8-bit block table lookup version: def ham(a, b, ht=[hamdist(a,0) for a in range(256)]): x = a ^ b dist = 0 while x: dist += ht[x & 255] x >>= 8 return dist Raymond -- http://mail.python.org/mailman/listinfo/python-list

Re: Pattern Matching Over Python Lists

2008-06-19 Thread John Machin
On Jun 20, 10:45 am, Chris <[EMAIL PROTECTED]> wrote: > On Jun 17, 1:09 pm, [EMAIL PROTECTED] wrote: > > > Kirk Strauser: > > > > Hint: recursion. Your general algorithm will be something like: > > > Another solution is to use a better (different) language, that has > > built-in pattern matching,

Re: Simple Class/Variable passing question

2008-06-19 Thread monkeyboy
On Jun 19, 6:37 pm, Matt Nordhoff <[EMAIL PROTECTED]> wrote: > monkeyboy wrote: > > Hello, > > > I'm new to python, and PythonCard. In the code below, I'm trying to > > create a member variable (self.currValue) of the class, then just pass > > it to a simple function (MainOutputRoutine) to incremen

Re: Null pattern

2008-06-19 Thread Ben Finney
George Sakkis <[EMAIL PROTECTED]> writes: > For example, consider the container methods __len__, __iter__ and > __contains__. The obvious choice for a null container is an empty > one. When taking __getitem__ into account though, the behaviour > looks inconsistent: > >>> Null[3] > Null >

Re: Pattern Matching Over Python Lists

2008-06-19 Thread Chris
On Jun 17, 1:09 pm, [EMAIL PROTECTED] wrote: > Kirk Strauser: > > > Hint: recursion. Your general algorithm will be something like: > > Another solution is to use a better (different) language, that has > built-in pattern matching, or allows to create one. > > Bye, > bearophile Btw, Python's stdl

Re: Pattern Matching Over Python Lists

2008-06-19 Thread Chris
Thanks for your help. Those weren't quite what I was looking for, but I ended up figuring it out on my own. Turns out you can actually search nested Python lists using simple regular expressions. -- http://mail.python.org/mailman/listinfo/python-list

At long last...

2008-06-19 Thread Carl Banks
Tuples will have an index method in Python 2.6. I promise I won't indiscriminately use tuples for homogenous data. Honest. Scout's honor. Cross my heart. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Hamming Distance

2008-06-19 Thread Matimus
On Jun 19, 4:27 pm, godavemon <[EMAIL PROTECTED]> wrote: > I need to calculate the Hamming Distance of two integers.  The hamming > distance is the number of bits in two integers that don't match.  I > thought there'd be a function in math or scipy but i haven't been able > to find one.  This is my

Null pattern

2008-06-19 Thread George Sakkis
I'd like to extend the Null pattern from http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/68205 to handle special methods (e.g. Null[3], del Null['key'], Null+1) but it's not always clear how to do it while keeping the behavior consistent and intuitive. For example, consider the container m

Re: Hamming Distance

2008-06-19 Thread Mensanator
On Jun 19, 6:27 pm, godavemon <[EMAIL PROTECTED]> wrote: > I need to calculate the Hamming Distance of two integers.  The hamming > distance is the number of bits in two integers that don't match.  I > thought there'd be a function in math or scipy but i haven't been able > to find one.  This is my

Re: Hamming Distance

2008-06-19 Thread Robert Kern
godavemon wrote: I need to calculate the Hamming Distance of two integers. The hamming distance is the number of bits in two integers that don't match. I thought there'd be a function in math or scipy but i haven't been able to find one. This is my function but it seems like there should be a

Re: Hamming Distance

2008-06-19 Thread John Machin
On Jun 20, 9:27 am, godavemon <[EMAIL PROTECTED]> wrote: > I need to calculate the Hamming Distance of two integers. The hamming > distance is the number of bits in two integers that don't match. I > thought there'd be a function in math or scipy but i haven't been able > to find one. This is my

Re: Hamming Distance

2008-06-19 Thread Raymond Hettinger
On Jun 19, 4:27 pm, godavemon <[EMAIL PROTECTED]> wrote: > I need to calculate the Hamming Distance of two integers.  The hamming > distance is the number of bits in two integers that don't match.  I > thought there'd be a function in math or scipy but i haven't been able > to find one.  This is my

Hamming Distance

2008-06-19 Thread godavemon
I need to calculate the Hamming Distance of two integers. The hamming distance is the number of bits in two integers that don't match. I thought there'd be a function in math or scipy but i haven't been able to find one. This is my function but it seems like there should be a faster way. I do t

Re: python/ruby question..

2008-06-19 Thread Matimus
On Jun 19, 4:00 pm, Matimus <[EMAIL PROTECTED]> wrote: > On Jun 18, 8:33 pm, "bruce" <[EMAIL PROTECTED]> wrote: > > > > > hi... > > > can someone point me to where/how i would go about calling a ruby app from a > > python app, and having the python app being able to get a returned value > > from th

Re: Why no output from xml.dom.ext.PrettyPrint?

2008-06-19 Thread John Machin
On Jun 20, 7:17 am, kj <[EMAIL PROTECTED]> wrote: > OK, the following should work but doesn't, and I can't figure out > why: > > >>> from xml.marshal.generic import dumps > >>> dumps( ( 1, 2.0, 'foo', [3,4,5] ) ) > > ' version="1.0"?>12.0foo id="i2">345' > > >>> from xml.dom.ext import PrettyPrint

Re: Simple and safe evaluator

2008-06-19 Thread Simon Forman
On Jun 16, 8:32 pm, bvdp <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > On Jun 17, 8:02 am, bvdp <[EMAIL PROTECTED]> wrote: > > >> Thanks. That was easy :) > > >>> The change to the _ast version is left as an exercise to the reader ;) > >> And I have absolutely no idea on how to do this.

Re: python/ruby question..

2008-06-19 Thread Matimus
On Jun 18, 8:33 pm, "bruce" <[EMAIL PROTECTED]> wrote: > hi... > > can someone point me to where/how i would go about calling a ruby app from a > python app, and having the python app being able to get a returned value > from the ruby script. > > something like > > test.py >  a = os.exec(testruby.r

Re: regex \b behaviour in python

2008-06-19 Thread MRAB
On Jun 19, 8:46 pm, André Malo <[EMAIL PROTECTED]> wrote: > * Walter Cruz wrote: > > irb(main):001:0>"walter ' cruz".split(/\b/) > > => ["walter", " ' ", "cruz"] > > > and in php: > > > Array > > ( > >     [0] => > >     [1] => walter > >     [2] =>  ' > >     [3] => cruz > >     [4] => > > ) > > >

don't make it worse! - was Re: SPAM

2008-06-19 Thread Michael Torrie
Aspersieman wrote: > SPAM Obviously. Please refrain from replying to the SPAM on this list. It just makes the problem worse. Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: Simple Class/Variable passing question

2008-06-19 Thread Matt Nordhoff
monkeyboy wrote: > Hello, > > I'm new to python, and PythonCard. In the code below, I'm trying to > create a member variable (self.currValue) of the class, then just pass > it to a simple function (MainOutputRoutine) to increment it. I thought > Python "passed by reference" all variables, but the

Re: Google-like "Did you mean... ?" search algorithm

2008-06-19 Thread cirfu
On 20 Juni, 00:14, [EMAIL PROTECTED] wrote: > This is a wee bit OT, but I am looking for algorithms to implement > search suggestions, similar to Google's "Did you mean... ?" feature. > Can anyone point me to web pages, journal articles, implementations > (preferably in Python!), or any other resou

Re: Google-like "Did you mean... ?" search algorithm

2008-06-19 Thread Pau Freixes
Do you need a [1] ngram theory, with this you can solve a orthographical problems, suggestion searches and other thinks [1] http://en.wikipedia.org/wiki/N-gram On Fri, Jun 20, 2008 at 12:14 AM, <[EMAIL PROTECTED]> wrote: > This is a wee bit OT, but I am looking for algorithms to implement > sear

Re: py2exe & application add-ons

2008-06-19 Thread Gabriel Genellina
En Thu, 19 Jun 2008 08:00:32 -0300, Alex Gusarov <[EMAIL PROTECTED]> escribió: > Hello, I've met a problem - I want my program working without Python > installation but I have some add-on mechanism (add-ons represented by > separate .py files, and application auto-recognize such files on > start).

Google-like "Did you mean... ?" search algorithm

2008-06-19 Thread miller . paul . w
This is a wee bit OT, but I am looking for algorithms to implement search suggestions, similar to Google's "Did you mean... ?" feature. Can anyone point me to web pages, journal articles, implementations (preferably in Python!), or any other resources in this area? Thanks! -- http://mail.python.or

Re: Noob: finding my way around the docs...

2008-06-19 Thread Matimus
On Jun 19, 2:06 pm, kj <[EMAIL PROTECTED]> wrote: > I'm a Python noob, and haven't yet figured out my way around the > Python documentation. > > For example, suppose I learn about some great module foo.bar.baz, > and when I run the python interpreter and type "import foo.bar.baz", > lo and behold,

Re: python script for tortoise cvs

2008-06-19 Thread Gabriel Genellina
En Thu, 19 Jun 2008 10:26:09 -0300, Simon Brunning <[EMAIL PROTECTED]> escribió: > On Thu, Jun 19, 2008 at 2:14 PM, sandeep <[EMAIL PROTECTED]> wrote: >> hi >> >> we are using tortoise cvs and putty. i want to write a python script >> to whom i can provide a tag and module.now what this script wil

Re: Multiprecision arithmetic library question.

2008-06-19 Thread casevh
> No, I do not know that. Define desperate. > Does Python support the extended Euclidean algorithm > and other number theory functions? No. > How fast does Python multiply? Python uses the Karatsuba algorithm which O(n^1.585). Division is still O(n^2). > Not that the latter is particularly impo

Re: Extending Python with C: Cannot find MPI library

2008-06-19 Thread John Machin
On Jun 20, 5:56 am, Jeroen Ruigrok van der Werven <[EMAIL PROTECTED] nomine.org> wrote: > -On [20080619 17:11], Spectrum ([EMAIL PROTECTED]) wrote: > > > ImportError: dynamic module does not define init function > > Might be it's looking, but not finding, something li

Re: [Python-Dev] C API for gc.enable() and gc.disable()

2008-06-19 Thread Pau Freixes
Sorry for my ignorance, gc it's garbage collector ? On Thu, Jun 19, 2008 at 11:23 PM, Alexandre Vassalotti < [EMAIL PROTECTED]> wrote: > On Sun, Jun 1, 2008 at 12:28 AM, Adam Olsen <[EMAIL PROTECTED]> wrote: > > On Sat, May 31, 2008 at 10:11 PM, Alexandre Vassalotti > > <[EMAIL PROTECTED]> wrote:

AW: [Zope3-Users] Python Package Construction

2008-06-19 Thread Roger Ineichen
Hi Tim > Betreff: [Zope3-Users] Python Package Construction > > Hi All, > > I would like feedback on the proper/best 'Pythonic' approach. > > This is a rather subjective question. Where is the trade-off > between package name lengths and faithfulness to the specifications? > > [Discussion fol

Why no output from xml.dom.ext.PrettyPrint?

2008-06-19 Thread kj
OK, the following should work but doesn't, and I can't figure out why: >>> from xml.marshal.generic import dumps >>> dumps( ( 1, 2.0, 'foo', [3,4,5] ) ) '12.0foo345' >>> from xml.dom.ext import PrettyPrint >>> PrettyPrint( dumps( ( 1, 2.0, 'foo', [3,4,5] ) ) ) >>> import sys >>> PrettyPrint( du

Docutils rst2html.py gives Unknown Directive type "toctree"

2008-06-19 Thread Calvin Cheng
Hi, I am attempting to convert a bunch of .txt files into html using the docutils package. It works for most of the txt files except for the index.txt file which gives 2 errors: (1) Unknown Directive type "toctree" (2) (ERROR/3) Unknown interpreted text role "ref". Any idea how I can fix this?

Re: Noob: finding my way around the docs...

2008-06-19 Thread Benjamin Kaplan
On Thu, Jun 19, 2008 at 5:06 PM, kj <[EMAIL PROTECTED]> wrote: > > > > I'm a Python noob, and haven't yet figured out my way around the > Python documentation. > > For example, suppose I learn about some great module foo.bar.baz, > and when I run the python interpreter and type "import foo.bar.baz

Noob: finding my way around the docs...

2008-06-19 Thread kj
I'm a Python noob, and haven't yet figured out my way around the Python documentation. For example, suppose I learn about some great module foo.bar.baz, and when I run the python interpreter and type "import foo.bar.baz", lo and behold, it is already installed on our system, which means that (k

Re: python/ruby question..

2008-06-19 Thread Mensanator
On Jun 19, 5:14 am, Matt Nordhoff <[EMAIL PROTECTED]> wrote: > Mensanator wrote: > You're supposed to use the subprocess module. Yeah, I know, but I couldn't get it to work the last time I tried it. > > In this case, something like: > > import subprocess > factor_program = ['factor!', '-d200'] >

Simple Class/Variable passing question

2008-06-19 Thread monkeyboy
Hello, I'm new to python, and PythonCard. In the code below, I'm trying to create a member variable (self.currValue) of the class, then just pass it to a simple function (MainOutputRoutine) to increment it. I thought Python "passed by reference" all variables, but the member variable doesn't seem

Re: Extending Python with C: Cannot find MPI library

2008-06-19 Thread André Malo
* Jeroen Ruigrok van der Werven wrote: > -On [20080619 17:11], Spectrum ([EMAIL PROTECTED]) wrote: >> ImportError: dynamic module does not define init function > > Might be it's looking, but not finding, something like crti.S or the > likes, the C runtime files that speci

Re: Installing Python 3.0 no probs running 2.5 at the same time?

2008-06-19 Thread Martin v. Löwis
> Can I install 3.0 without breaking 2.5? Meaning does it overwrite some > bindings or something or it just installs 3.0 in a different folder as > a completely separate program? You can install both simultaneously, however, by default, .py will get associated with the last installation. If you do

Re: Extending Python with C: Cannot find MPI library

2008-06-19 Thread Jeroen Ruigrok van der Werven
-On [20080619 17:11], Spectrum ([EMAIL PROTECTED]) wrote: > ImportError: dynamic module does not define init function Might be it's looking, but not finding, something like crti.S or the likes, the C runtime files that specify stuff like _init and _fini. -- Jeroen Ruigrok van de

[xlwt] Changing Cell Background Color

2008-06-19 Thread Chanman
I've posted this on the python-excel group, but perhaps people here know what to do. How does one change the cell background color using the xlwt module? I've looked at several tutorials but none show how to change the background color. I've tried the following: badBG = xlwt.Pattern() badBG.SOLI

Re: regex \b behaviour in python

2008-06-19 Thread André Malo
* Walter Cruz wrote: > irb(main):001:0>"walter ' cruz".split(/\b/) > => ["walter", " ' ", "cruz"] > > and in php: > > Array > ( > [0] => > [1] => walter > [2] => ' > [3] => cruz > [4] => > ) > > > But in python the behaviour of \b is differente from ruby or php. My python

Re: Python-3.0b1 build fails on Linux : _gestalt

2008-06-19 Thread Martin v. Löwis
> Failed to find the necessary bits to build these modules: > _gestalt > > Looking at setup.py it seems that module '_gestalt' > is only needed on Darwin but my build on Linux fails > nevertheless. Why do you think the build fails (i.e. what specific error message makes you believe it failed)? R

Re: Checking for network connectivity

2008-06-19 Thread Jefferson Kirkland
>From the socket module, you could use the s.connect(address) function. It returns a 0 on success or the value of errno on failure. Regards, Jeff On Thu, Jun 19, 2008 at 2:36 PM, felciano <[EMAIL PROTECTED]> wrote: > Hi -- > > Is there a clean pythonic way to check for network connectivity? I

Python Package Construction

2008-06-19 Thread Tim Cook
Hi All, I would like feedback on the proper/best 'Pythonic' approach. This is a rather subjective question. Where is the trade-off between package name lengths and faithfulness to the specifications? [Discussion follows] I am implementing a set of specifications for healthcare IT for Python pro

Re: python/ruby question..

2008-06-19 Thread Mike Driscoll
On Jun 19, 11:49 am, [EMAIL PROTECTED] (Aahz) wrote: > In article <[EMAIL PROTECTED]>, > Matt Nordhoff  <[EMAIL PROTECTED]> wrote: > > > > >You're supposed to use the subprocess module. > > Really?  Sez who? > > $ python > Python 2.3.4 (#1, Feb  2 2005, 12:11:53) > [GCC 3.4.2 20041017 (Red Hat 3.4.

Checking for network connectivity

2008-06-19 Thread felciano
Hi -- Is there a clean pythonic way to check for network connectivity? I have a script that needs to run periodically on a laptop to create a local cache of some network files. I would like it to fail gracefully when disconnected, as well as issue a warning if it hasn't been able to connect for X

Re: python/ruby question..

2008-06-19 Thread Giampaolo Rodola'
On 19 Giu, 18:49, [EMAIL PROTECTED] (Aahz) wrote: > In article <[EMAIL PROTECTED]>, > Matt Nordhoff  <[EMAIL PROTECTED]> wrote: > > > > >You're supposed to use the subprocess module. > > Really?  Sez who? > > $ python > Python 2.3.4 (#1, Feb  2 2005, 12:11:53) > [GCC 3.4.2 20041017 (Red Hat 3.4.2-6

Re: Getting Python to run Python Scripts in cygwin

2008-06-19 Thread Jason Tishler
Calvin, On Fri, Jun 20, 2008 at 12:14:03AM +0800, Calvin Cheng wrote: > This may be a cygwin issue but I was hoping to get some answers here > as well if someone has fixed this problem before. > > Basically, I am able to run "python .py" python files in > command prompt. Unfortunately, I can't s

Re: Simple wxPython SetLabel question

2008-06-19 Thread Mike Driscoll
On Jun 19, 5:25 am, dp_pearce <[EMAIL PROTECTED]> wrote: > Thank you very much Cédric. I thought it would be something very > straight forward. Just an FYI. There's also a wxPython specific mailing list that I highly recommend. You can learn a lot just reading other people issues and how they get

Re: py2exe & application add-ons

2008-06-19 Thread Mike Driscoll
On Jun 19, 6:00 am, "Alex Gusarov" <[EMAIL PROTECTED]> wrote: > Hello, I've met a problem - I want my program working without Python > installation but I have some add-on mechanism (add-ons represented by > separate .py files, and application auto-recognize such files on > start). > > So, if I will

Re: Getting Python to run Python Scripts in cygwin

2008-06-19 Thread kretik
You do have Python installed in Cygwin, right? It's an optional component, IIRC? If it is then it should have set the symlink in /usr/bin to wherever it's installed. Calvin Cheng wrote: Hi guys, This may be a cygwin issue but I was hoping to get some answers here as well if someone has fixe

Re: python/ruby question..

2008-06-19 Thread Aahz
In article <[EMAIL PROTECTED]>, Matt Nordhoff <[EMAIL PROTECTED]> wrote: > >You're supposed to use the subprocess module. Really? Sez who? $ python Python 2.3.4 (#1, Feb 2 2005, 12:11:53) [GCC 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)] on linux2 Type "help", "copyright", "credits" or "license" for

Re: py2exe & application add-ons

2008-06-19 Thread Matthew Woodcraft
Alex Gusarov <[EMAIL PROTECTED]> wrote: > Hello, I've met a problem - I want my program working without Python > installation but I have some add-on mechanism (add-ons represented by > separate .py files, and application auto-recognize such files on > start). > So, if I will using py2exe for main

Re: Getting Python to run Python Scripts in cygwin

2008-06-19 Thread Cédric Lucantis
Le Thursday 19 June 2008 18:14:03 Calvin Cheng, vous avez écrit : > Hi guys, > > This may be a cygwin issue but I was hoping to get some answers here > as well if someone has fixed this problem before. > > Basically, I am able to run "python .py" python files in > command prompt. Unfortunately, I

Re: dict order

2008-06-19 Thread Aahz
In article <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> wrote: > >Whoops > >for keys, values in dict_one.items(): > if keys in dict_two: >if values == dict_two[keys]: Except that "keys" implies a plural (meaning more than one thing); in a for loop, each iteration will have only one key. -- Aahz

Getting Python to run Python Scripts in cygwin

2008-06-19 Thread Calvin Cheng
Hi guys, This may be a cygwin issue but I was hoping to get some answers here as well if someone has fixed this problem before. Basically, I am able to run "python .py" python files in command prompt. Unfortunately, I can't seem to get it to work in cygwin. I always get an error that says: pyth

Re: Convert string to array of floats

2008-06-19 Thread Jonno
Brilliant! Thanks. On Thu, Jun 19, 2008 at 10:00 AM, Cédric Lucantis <[EMAIL PROTECTED]> wrote: > Le Thursday 19 June 2008 17:12:08 Jonno, vous avez écrit : > > Hi, > > > > I'm very new to programming and python. > > > > I need to convert a string like this: > > ' 0.906366 2.276

Pydev 1.3.18 Released

2008-06-19 Thread Fabio Zadrozny
Hi All, Pydev and Pydev Extensions 1.3.18 have been released Details on Pydev Extensions: http://www.fabioz.com/pydev Details on Pydev: http://pydev.sf.net Details on its development: http://pydev.blogspot.com Release Highlights in Pydev Extensions: --

Re: Installing Python 3.0 no probs running 2.5 at the same time?

2008-06-19 Thread Cédric Lucantis
Le Thursday 19 June 2008 17:32:10 cirfu, vous avez écrit : > Can I install 3.0 without breaking 2.5? Meaning does it overwrite some > bindings or something or it just installs 3.0 in a different folder as > a completely separate program? It's OK for any version having different major/minor version

Re: Convert string to array of floats

2008-06-19 Thread Cédric Lucantis
Le Thursday 19 June 2008 17:12:08 Jonno, vous avez écrit : > Hi, > > I'm very new to programming and python. > > I need to convert a string like this: > ' 0.906366 2.276152 0.01336980.773141 > 0.002836 -107.335197 0.01146286.846290\n' > to an array of floa

regex \b behaviour in python

2008-06-19 Thread Walter Cruz
Hi all! Just a simple question about the behaviour of a regex in python. (I discussed this on IRC, and they suggest me to post here). I tried to split the string "walter ' cruz" using \b . In ruby, it returns: irb(main):001:0>"walter ' cruz".split(/\b/) => ["walter", " ' ", "cruz"] and in php

Re: Simple Python class questions

2008-06-19 Thread Ulrich Eckhardt
Lie wrote: > I think it's not that hard to see that it's just a pseudo code "...in comms.py I have: ..." actually explicitly says that it is actual code from a file. *shrug* Uli -- Sator Laser GmbH Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932 -- http://mail.python.org/ma

Re: advanced listcomprehenions?

2008-06-19 Thread Mark Wooding
Duncan Booth <[EMAIL PROTECTED]> wrote: > [['Fizz', 'Buzz', 'FizzBuzz', str(i)][62/(pow(i, 4, 15) + 1)%4] for i in > xrange(1, 101)] Cute! ;-) -- [mdw] -- http://mail.python.org/mailman/listinfo/python-list

Installing Python 3.0 no probs running 2.5 at the same time?

2008-06-19 Thread cirfu
Can I install 3.0 without breaking 2.5? Meaning does it overwrite some bindings or something or it just installs 3.0 in a different folder as a completely separate program? -- http://mail.python.org/mailman/listinfo/python-list

Re: Simple Python class questions

2008-06-19 Thread Lie
On Jun 19, 7:21 pm, Ulrich Eckhardt <[EMAIL PROTECTED]> wrote: > John Dann wrote: > > Let's say I define the class in a module called comms.py. The class > > isn't really going to inherit from any other class (except presumably > > in the most primitive base-class sense, which is presumably automat

Convert string to array of floats

2008-06-19 Thread Jonno
Hi, I'm very new to programming and python. I need to convert a string like this: ' 0.906366 2.276152 0.01336980.773141 0.002836 -107.335197 0.01146286.846290\n' to an array of floats. Any pointers to the simplest way of doing this? Thanks. -- "If a

Re: Extending Python with C: Cannot find MPI library

2008-06-19 Thread Spectrum
On Jun 19, 4:39 pm, Jeroen Ruigrok van der Werven <[EMAIL PROTECTED] nomine.org> wrote: > -On [20080619 16:21], Spectrum ([EMAIL PROTECTED]) wrote: > > >          libmpi.so.0 => /usr/lib/openmpi/1.2.4-gcc/libmpi.so.0 > >(0x0042f000) > >          libopen-rte.s

Re: Extending Python with C: Cannot find MPI library

2008-06-19 Thread Jeroen Ruigrok van der Werven
-On [20080619 16:21], Spectrum ([EMAIL PROTECTED]) wrote: > libmpi.so.0 => /usr/lib/openmpi/1.2.4-gcc/libmpi.so.0 >(0x0042f000) > libopen-rte.so.0 => /usr/lib/openmpi/1.2.4-gcc/libopen- >rte.so.0 (0x003d4000) > libopen-pal.so.0 => /usr/lib/o

Simple Python implementation of bag/multiset

2008-06-19 Thread MRAB
While another thread is talking about an ordered dict, I thought I'd try a simple implementation of a bag/multiset in Python. Comments/ suggestions welcome, etc. class bag(object): def __add__(self, other): result = self.copy() for item, count in other.iteritems():

Re: How do i : Python Threads + KeyboardInterrupt exception

2008-06-19 Thread MRAB
On Jun 19, 7:54 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Wed, 18 Jun 2008 21:33:42 -0700 (PDT), Brendon Costa > <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: > > > Unfortunately that is the problem. It is blocking in a IO system call > > and i want to force it to exi

Re: PEP 372 -- Adding an ordered directory to collections

2008-06-19 Thread bearophileHUGS
Duncan Booth: > What do you get if you change the output to exclude the integers from > the memory calculation so you are only looking at the dictionary > elements themselves? e.g. The results: 318512 (kbytes) 712124 (kbytes) 20.1529344 (bytes) Bye, bearophile -- http://mail.python.org/mailman/l

Re: python/ruby question..

2008-06-19 Thread Michael Mabin
The commands module might help you out as well. import commands as c output = c.getoutput('testruby.rb') On Thu, Jun 19, 2008 at 5:14 AM, Matt Nordhoff <[EMAIL PROTECTED]> wrote: > Mensanator wrote: > > On Jun 18, 10:33�pm, "bruce" <[EMAIL PROTECTED]> wrote: > >> hi... > >> > >> can someone poi

Re: Extending Python with C: Cannot find MPI library

2008-06-19 Thread Spectrum
On Jun 19, 2:10 pm, Jeroen Ruigrok van der Werven <[EMAIL PROTECTED] nomine.org> wrote: > -On [20080619 13:53], Spectrum ([EMAIL PROTECTED]) wrote: > > >  ImportError: /big/School/Cluster/Opgave03/ctest.so: undefined > >symbol: ompi_mpi_comm_world > > [EMAIL PROTECTED

Re: Simple Python class questions

2008-06-19 Thread Cédric Lucantis
Le Thursday 19 June 2008 15:13:39 John Dann, vous avez écrit : > Many thanks for the speedy replies. > > On Thu, 19 Jun 2008 14:14:02 +0200, Cédric Lucantis <[EMAIL PROTECTED]> > > wrote: > >Le Thursday 19 June 2008 13:54:03 John Dann, vous avez écrit : > >> Let's say I define the class in a module

Re: python script for tortoise cvs

2008-06-19 Thread Simon Brunning
On Thu, Jun 19, 2008 at 2:14 PM, sandeep <[EMAIL PROTECTED]> wrote: > hi > > we are using tortoise cvs and putty. i want to write a python script > to whom i can provide a tag and module.now what this script will do is > look for this specific tag and checks for whether its a individual tag > or it

  1   2   >