Re: Which Python web framework is most like Ruby on Rails?

2005-12-21 Thread Steve Holden
Kent Johnson wrote: > Luis M. Gonzalez wrote: > >>I don't think Pierre (Karrigell's creator) is awared of licenses and >>legal issues. >>Perhaps you can tell us what's the problem with GPL and, if possible, >>propose an alternative... > > > OK I'll try. First let me say I have no interest in a l

Re: Why my thread can't access the global data?

2005-12-21 Thread Antoon Pardon
Op 2005-12-21, ddh schreef <[EMAIL PROTECTED]>: > Hi, > I got a problem. I use a 'select' in a loop in the main thread, and > when select return, a new thread will be created to handle the network > event. And if the client send some special string, the thread will > change a global flag to false

Re: ANNOUNCE; Try python beta

2005-12-21 Thread Eric
On 20 December 2005, Mike Meyer wrote: > Ok, I've given it the interface I want, and made it less of an > attractive nuisance. > > http://www.mired.org/home/mwm/try_python/ is now ready for people to > play with. There's no tutorial information on it yet, that's the next > thing to do. However, I w

Re: Why my thread can't access the global data?

2005-12-21 Thread ddh
Thank you very much. I am a newbie for python :-) Antoon Pardon wrote: > > It has nothing to do with threads. If you assign to a name in > a function, that name will be treated as a local variable. So > the go_on = False in read_send will not affect the global go_on. > > If you want to rebind glo

Re: Xah's Edu Corner: Responsible Software Licensing

2005-12-21 Thread robic0
On Mon, 19 Dec 2005 10:05:59 GMT, Roedy Green <[EMAIL PROTECTED]> wrote: >On Sun, 18 Dec 2005 18:42:52 -0800, robic0 wrote, quoted or indirectly >quoted someone who said : > >>If the software opens a file and is in the middle of writing to it, >>then the user dumps the power to the machine and end

Re: Which Python web framework is most like Ruby on Rails?

2005-12-21 Thread Paul Rubin
Steve Holden <[EMAIL PROTECTED]> writes: > > However the work I do is commercial and proprietary and I doubt > > I could get approval to release it under GPL. > I see the GPL is a problem in this environment, and you are clearly > aware of the issues it raises. Do be aware, though, that not all GP

Re: Which Python web framework is most like Ruby on Rails?

2005-12-21 Thread Pierre Quentel
Hello all, I am Karrigell's author. I have chosen the GPL licence almost at random (I saw that the Python licence was GPL-compatible), so I don't mind switching to another Open Source licence if the GPL is liable to cause problems. Which one would you advice : BSD ? Python licence ? another ? Reg

Re: Which Python web framework is most like Ruby on Rails?

2005-12-21 Thread Paul Rubin
"Pierre Quentel" <[EMAIL PROTECTED]> writes: > I am Karrigell's author. I have chosen the GPL licence almost at random > (I saw that the Python licence was GPL-compatible), so I don't mind > switching to another Open Source licence if the GPL is liable to cause > problems. Which one would you advic

Re: how to lock a file in ftp site

2005-12-21 Thread Kinsley Turner
> I've come across this problem - instead of uploading the file to it's > > intended directory, upload it to a temp directory, with a unique name > (say ummddhhmmss where u is username and the rest are > obvious) and then *rename* it to it's correct name in the real > destination dir

Re: Which Python web framework is most like Ruby on Rails?

2005-12-21 Thread Steve Holden
Paul Rubin wrote: > Steve Holden <[EMAIL PROTECTED]> writes: > >>>However the work I do is commercial and proprietary and I doubt >>>I could get approval to release it under GPL. >> >>I see the GPL is a problem in this environment, and you are clearly >>aware of the issues it raises. Do be aware,

Re: Which Python web framework is most like Ruby on Rails?

2005-12-21 Thread Paul Rubin
Steve Holden <[EMAIL PROTECTED]> writes: > Indeed. But most software authors aren't lawyers and aren't likely to > trust their own judgment about these matters unless the situation is > pretty unambiguous. I suspect this may be evidence that Microsoft's > "viral" propaganda has had some effect. H

Re: Wanted: binary of OpenCV Python extension module for Windows

2005-12-21 Thread Claudio Grondi
Claudio Grondi wrote: > > OpenCV means Intel® Open Source Computer Vision Library. It is a > collection of C functions and a few C++ classes that implement some > popular Image Processing and Computer Vision algorithms. > OpenCV library is mainly aimed at real time computer vision. Some > exam

Is it possible to use python to unit test C++ code?

2005-12-21 Thread sylcheung
Is it possible to use python to unit test C++ code? If yes, is there any example available? Thank you. -- http://mail.python.org/mailman/listinfo/python-list

Re: type 'slice' is not an acceptable base type

2005-12-21 Thread Antoon Pardon
Op 2005-12-21, Michael Hoffman schreef <[EMAIL PROTECTED]>: > Antoon Pardon wrote: > >> Traceback (most recent call last): >> File "", line 1, in ? >> File "vslice.py", line 48, in ? >> class iterslice(slice): >> TypeError: Error when calling the metaclass bases >> type 'slice' is not a

Parsing a date-time string?

2005-12-21 Thread Tim N. van der Leeuw
Hi, I want to parse strings containing date-time, which look like the following: "Mon Dec 19 11:06:12:333 CET 2005" That's a problem for strptime it seems, b/c I cannot find any format-spec for the milliseconds-part in here. (I'm also not sure about the validity of the tz part, but ...) As an

Globals, Locals Dictionaries + Callbacks Question

2005-12-21 Thread Faisal Alquaddoomi
Hello, I'm having a bit of trouble isolating my scripts from each other in my embedded Python interpreter, so that their global namespaces don't get all entangled. I've had some luck with PyRun_FileEx(), as you can specify dictionaries to use for the globals and locals, but it seems that you c

scipy.stats.itemfreq: overflow with add.reduce

2005-12-21 Thread Hans Georg Krauthaeuser
Hi All, I was playing with scipy.stats.itemfreq when I observed the following overflow: In [119]:for i in [254,255,256,257,258]: .:l=[0]*i .:print i, stats.itemfreq(l), l.count(0) .: 254 [ [ 0 254]] 254 255 [ [ 0 255]] 255 256 [ [0 0]] 256 257 [ [0 1]] 257 258 [

Re: Parsing a date-time string?

2005-12-21 Thread Fuzzyman
Quick response - there is a DateUtil module with a *very* flexible string-to-date parser. It will almost certainly do what you want : http://labix.org/python-dateutil All the best, Fuzzyman http://www.voidspace.org.uk/python/index.shtml -- http://mail.python.org/mailman/listinfo/python-list

How to check if a string "is" an int?

2005-12-21 Thread [EMAIL PROTECTED]
How do I check if a string contains (can be converted to) an int? I want to do one thing if I am parsing and integer, and another if not. /David -- http://mail.python.org/mailman/listinfo/python-list

Re: Is it possible to use python to unit test C++ code?

2005-12-21 Thread Alex Stapleton
On 21 Dec 2005, at 09:33, [EMAIL PROTECTED] wrote: > Is it possible to use python to unit test C++ code? If yes, is there > any example available? > > Thank you. > > -- > http://mail.python.org/mailman/listinfo/python-list You could use Python to unittest a Python module written in C++ I sup

Re: putting checkbuttons in a listbox

2005-12-21 Thread Martin Franklin
valen1260 wrote: > I'd like to have a multicolumn listbox, with one column being a list of > items and the other being a list of checkbuttons. The user could check > his "favorites" and then shorten the list to show only the checked items. > > I have implemented the MultiListbox at > http://as

Re: Which Python web framework is most like Ruby on Rails?

2005-12-21 Thread Pierre Quentel
I definitely don't want to invent another licence, there are enough of them already ! Pierre -- http://mail.python.org/mailman/listinfo/python-list

Re: How to check if a string "is" an int?

2005-12-21 Thread Erik Max Francis
[EMAIL PROTECTED] wrote: > How do I check if a string contains (can be converted to) an int? I > want to do one thing if I am parsing and integer, and another if not. try: x = int(aPossibleInt) ... do something with x ... except ValueError: ...

Re: Which Python web framework is most like Ruby on Rails?

2005-12-21 Thread Ben Sizer
Paul Rubin wrote: > "Pierre Quentel" <[EMAIL PROTECTED]> writes: > > I am Karrigell's author. I have chosen the GPL licence almost at random > > (I saw that the Python licence was GPL-compatible), so I don't mind > > switching to another Open Source licence if the GPL is liable to cause > > problem

Re: scipy.stats.itemfreq: overflow with add.reduce

2005-12-21 Thread Hans Georg Krauthaeuser
Hans Georg Krauthaeuser schrieb: > Hi All, > > I was playing with scipy.stats.itemfreq when I observed the following > overflow: > > In [119]:for i in [254,255,256,257,258]: >.:l=[0]*i >.:print i, stats.itemfreq(l), l.count(0) >.: > 254 [ [ 0 254]] 254 > 255 [ [

Re: Which Python web framework is most like Ruby on Rails?

2005-12-21 Thread Paul Rubin
"Ben Sizer" <[EMAIL PROTECTED]> writes: > Unfortunately, that doesn't really satisfy the GPL's concerns. The work > arguably "contains or is derived from" Karrigell, I don't see that. The web app gets run by Karrigell like a CGI script is run by Apache, like a Linux app is run by the Linux kernel

Re: Which Python web framework is most like Ruby on Rails?

2005-12-21 Thread Richie Hindle
[Pierre] > I am Karrigell's author. I have chosen the GPL licence almost at random > (I saw that the Python licence was GPL-compatible), so I don't mind > switching to another Open Source licence if the GPL is liable to cause > problems. Which one would you advice : BSD ? Python licence ? another

Re: Which Python web framework is most like Ruby on Rails?

2005-12-21 Thread Paul Rubin
Richie Hindle <[EMAIL PROTECTED]> writes: > A good solution would be multiple-licensing. You state that the > code is (for example) triple-licensed under the GPL, LGPL and BSD > licenses. The user of your code decides which license to obey. > It's no more work for you, and you can please almost e

coverting EST to PST

2005-12-21 Thread Narendra
Hi All, i got a problem. I need to convert time from EST standard to PST standard. Thu, 15 Dec 2005 09:24:19 -0500 to PST this time i need to convert as PST time is there any python code which helps me. your help will be greatly apreciated. Thanks, Narendra -- http://mail.python.org/mailman

Guido at Google

2005-12-21 Thread JB
It seems that our master Guido van Rossum had an offer from google and he accepted it!! long life to Guido & Goole ! many things to come ;) ju² -- http://mail.python.org/mailman/listinfo/python-list

Re: How to check if a string "is" an int?

2005-12-21 Thread Steven D'Aprano
On Wed, 21 Dec 2005 02:12:35 -0800, [EMAIL PROTECTED] wrote: > How do I check if a string contains (can be converted to) an int? I > want to do one thing if I am parsing and integer, and another if not. Okay, this has got to be homework, surely. This is the third, maybe the fourth, question on th

Re: Which Python web framework is most like Ruby on Rails?

2005-12-21 Thread Kent Johnson
Steve Holden wrote: > Paul Rubin wrote: >> I'm trying to avoid flame wars too, but my take on this is that Kent's >> reading is a little too restrictive and the GPL isn't really a problem >> in this situation unless he's actually modifying Karrigell itself, >> rather than writing applications that

Re: Which Python web framework is most like Ruby on Rails?

2005-12-21 Thread Raffaele Salmaso
Pierre Quentel ha scritto: > Hello all, > > I am Karrigell's author. I have chosen the GPL licence almost at random > (I saw that the Python licence was GPL-compatible), so I don't mind > switching to another Open Source licence if the GPL is liable to cause > problems. Which one would you advice

Re: How to check if a string "is" an int?

2005-12-21 Thread Neuruss
Can't we just check if the string has digits? For example: >>> x = '15' >>> if x.isdigit(): print int(x)*3 45 >>> -- http://mail.python.org/mailman/listinfo/python-list

Re: Guido at Google

2005-12-21 Thread Fuzzyman
That's potentially very good news. (Or slightly sinister -depending on your paranoia levels). You got any references on that ? I was just thinking that the open source offerings from google are actually pretty pitiful - considering the time investment they have put into developing software system

Re: Which Python web framework is most like Ruby on Rails?

2005-12-21 Thread Arthur Clune
Kent Johnson wrote: > > OK I'll try. First let me say I have no interest in a licensing flame war, > there are valid > reasons why an author might prefer one license over another and certainly > there are good > reasons to choose GPL. However the work I do is commercial and proprietary > and

Re: How to check if a string "is" an int?

2005-12-21 Thread [EMAIL PROTECTED]
It's not homework in my case, I don't know about the others :) -- http://mail.python.org/mailman/listinfo/python-list

Re: How to check if a string "is" an int?

2005-12-21 Thread Juho Schultz
Neuruss wrote: > Can't we just check if the string has digits? > For example: > > x = '15' if x.isdigit(): > > print int(x)*3 > > > 45 > > No, we can't. '-15' has non-digits but is a valid int. Another point is that the try-except can also be used for string-to-float con

Re: Globals, Locals Dictionaries + Callbacks Question

2005-12-21 Thread Steve Holden
Faisal Alquaddoomi wrote: > Hello, > > I'm having a bit of trouble isolating my scripts from each other in my > embedded Python interpreter, so that their global namespaces don't get > all entangled. [tales of woe ...] Would it help to use PyNewInterpreter to create subinterpreters for each

Re: Which Python web framework is most like Ruby on Rails?

2005-12-21 Thread Fuzzyman
BSD license is good. It requires that your copyright notice be included with any derivative works - but otherwise lets users create and distribute derivatives how they see fit. The version I use is at http://www.voidspace.org.uk/python/license.shtml (which links to the version at the OSI). The MIT

Re: ANNOUNCE; Try python beta

2005-12-21 Thread Maravilloso
I'm afraid that I've spoiled the "try_python" working by means of executing the sentence: open("try.py").write("\n") Sorry. I hope it don't be difficult for you to restore the module again to the default folder. In any case, I think it should include some control for malicious code like that one

Re: How to check if a string "is" an int?

2005-12-21 Thread Steven D'Aprano
On Wed, 21 Dec 2005 03:37:27 -0800, Neuruss wrote: > Can't we just check if the string has digits? Why would you want to? > For example: > x = '15' if x.isdigit(): > print int(x)*3 15 is not a digit. 1 is a digit. 5 is a digit. Putting them together to make 15 is not a digit.

Creating interactive command-line Python app?

2005-12-21 Thread planetthoughtful
Hello All, Newbie to Python, and I'm wondering if it's possible to create a Python console app that prompts for further input on the command line when run (in Windows XP, if that's important)? I've tried Googling, but the results are overwhelmingly about interactive Python environments (IPython e

Re: How to check if a string "is" an int?

2005-12-21 Thread Kent Johnson
Steven D'Aprano wrote: > On Wed, 21 Dec 2005 03:37:27 -0800, Neuruss wrote: >x = '15' >if x.isdigit(): >> >> print int(x)*3 > > > 15 is not a digit. 1 is a digit. 5 is a digit. Putting them together to > make 15 is not a digit. Maybe so, but '15'.isdigit() == True: isdigit(...)

Re: How to check if a string "is" an int?

2005-12-21 Thread Paul Rubin
Kent Johnson <[EMAIL PROTECTED]> writes: > Maybe so, but '15'.isdigit() == True: > > isdigit(...) > S.isdigit() -> bool > > Return True if all characters in S are digits > and there is at least one character in S, False otherwise. Auh!! -- http://mail.python.org/mailman/listi

Re: How to check if a string "is" an int?

2005-12-21 Thread Antoon Pardon
Op 2005-12-21, Steven D'Aprano schreef <[EMAIL PROTECTED]>: > On Wed, 21 Dec 2005 03:37:27 -0800, Neuruss wrote: > >> Can't we just check if the string has digits? > > Why would you want to? > > >> For example: >> > x = '15' > if x.isdigit(): >> print int(x)*3 > > 15 is not a digit. 1

Re: Which Python web framework is most like Ruby on Rails?

2005-12-21 Thread Kent Johnson
Paul Rubin wrote: > Kent Johnson <[EMAIL PROTECTED]> writes: > >>You've lost me here. The server certainly would contain Karrigell >>code, it wouldn't function without it. I don't understand the analogy >>to GCC, the web site is not something that is compiled with >>Karrigell. Karrigell is a libra

Re: Creating interactive command-line Python app?

2005-12-21 Thread Steve Holden
planetthoughtful wrote: > Hello All, > > Newbie to Python, and I'm wondering if it's possible to create a Python > console app that prompts for further input on the command line when run > (in Windows XP, if that's important)? > > I've tried Googling, but the results are overwhelmingly about > in

Re: How to check if a string "is" an int?

2005-12-21 Thread Steven D'Aprano
On Wed, 21 Dec 2005 07:36:15 -0500, Kent Johnson wrote: > Maybe so, but '15'.isdigit() == True: Well I'll be a monkey's uncle. In that case, the name is misleadingly wrong. I suppose it is not likely that it could be changed before Python 3? -- Steven -- http://mail.python.org/mailman/listin

Re: How to check if a string "is" an int?

2005-12-21 Thread bonono
Steven D'Aprano wrote: > If you really wanted to waste CPU cycles, you could do this: > > s = "1579" > for c in s: > if not c.isdigit(): > print "Not an integer string" > break > else: > # if we get here, we didn't break > print "Integer %d" % int(s) > > > but notice th

Re: How to check if a string "is" an int?

2005-12-21 Thread Roy Smith
In article <[EMAIL PROTECTED]>, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > How do I check if a string contains (can be converted to) an int? I > want to do one thing if I am parsing and integer, and another if not. > > /David The most straight-forward thing is to try converting it to an i

os.path.splitext() and case sensitivity

2005-12-21 Thread rbt
Hi, Is there a way to make os.path.splitext() case agnostic? def remove_file_type(target_dir, file_type): for root, dirs, files in os.walk(target_dir): for f in files: if os.path.splitext(os.path.join(root, f))[1] in file_type: pass remove_file_type(sy

Re: How to check if a string "is" an int?

2005-12-21 Thread Peter Hansen
Steven D'Aprano wrote: > On Wed, 21 Dec 2005 07:36:15 -0500, Kent Johnson wrote: >>Maybe so, but '15'.isdigit() == True: > > Well I'll be a monkey's uncle. > > In that case, the name is misleadingly wrong. I suppose it is not likely > that it could be changed before Python 3? That was my first t

Re: os.path.splitext() and case sensitivity

2005-12-21 Thread Juho Schultz
rbt wrote: > Hi, > > Is there a way to make os.path.splitext() case agnostic? > > def remove_file_type(target_dir, file_type): > for root, dirs, files in os.walk(target_dir): > for f in files: > if os.path.splitext(os.path.join(root, f))[1] in file_type: >

Re: os.path.splitext() and case sensitivity

2005-12-21 Thread Richie Hindle
[rbt] > Is there a way to make os.path.splitext() case agnostic? > > def remove_file_type(target_dir, file_type): > for root, dirs, files in os.walk(target_dir): > for f in files: > if os.path.splitext(os.path.join(root, f))[1] in file_type: > pass > >

Re: When Python *Eggs* better than Python *distutils*?? What's Eggs?

2005-12-21 Thread Maurice LING
Xavier Morel wrote: > [EMAIL PROTECTED] wrote: > >> So basically Python Eggs precompiles and compresses >> binaries for you so you just have to load it to run >> your app? >> > > Nah, Eggs is a packaging system, what you don't have to do is > compile/configure, because the packaging does that f

Re: os.path.splitext() and case sensitivity

2005-12-21 Thread rbt
Richie Hindle wrote: > [rbt] >> Is there a way to make os.path.splitext() case agnostic? >> >> def remove_file_type(target_dir, file_type): >> for root, dirs, files in os.walk(target_dir): >> for f in files: >> if os.path.splitext(os.path.join(root, f))[1] in file_type: >

Re: Which Python web framework is most like Ruby on Rails?

2005-12-21 Thread Ben Sizer
Paul Rubin wrote: > "Ben Sizer" <[EMAIL PROTECTED]> writes: > > Unfortunately, that doesn't really satisfy the GPL's concerns. The work > > arguably "contains or is derived from" Karrigell, > > I don't see that. The web app gets run by Karrigell like a CGI script > is run by Apache, like a Linux a

libxml2 and mindom

2005-12-21 Thread ankit
I am parsing xml file using libxml2 and for navigating the document object tree I want to use minidom. Is it possible. Can anyone give me any example for the same ? -- http://mail.python.org/mailman/listinfo/python-list

Re: parsing engineering symbols

2005-12-21 Thread Suresh Jeevanandam
Exactly what I wanted. It would be nice if the standard float function takes care of these. regards, Suresh > how about: > > SI_prefixes = { > 'Y':24, 'Z':21, 'E':18, 'P':15, 'T':12, 'G':9, 'M':6, 'k':3, > 'h':2, 'd':-1, 'c':-2, 'm':-3, u'\xb5':-6, 'u':-6, 'n':-9, 'p':-12, > 'f':-1

Re: os.path.splitext() and case sensitivity

2005-12-21 Thread rbt
Juho Schultz wrote: > rbt wrote: >> Hi, >> >> Is there a way to make os.path.splitext() case agnostic? >> >> def remove_file_type(target_dir, file_type): >> for root, dirs, files in os.walk(target_dir): >> for f in files: >> if os.path.splitext(os.path.join(root, f))[1] in f

Re: Guido at Google

2005-12-21 Thread Harald Armin Massa
> It seems that our master Guido van Rossum had an offer from google and > he accepted it!! Isn't Guido-Sans official title BDFL? *wink* whatever, if it's true, congratulations and best wishes. Now there is one *bot and the BDFL at google, we have still 3 bots in the wild, do we? Suggesting to n

Easiest way to calculate number of character in string

2005-12-21 Thread P. Schmidt-Volkmar
Hi there, I have a string in which I want to calculate how often the character ';' occurs. If the character does not occur 42 times, the ";" should be added so the 42 are reached. My solution is slow and wrong: for Position in range (0, len(Zeile)): if Zeile[Position]==';': AnzahlS

Re: Creating interactive command-line Python app?

2005-12-21 Thread keirr
You may also find the cmd module useful, see: http://docs.python.org/lib/module-cmd.html Cheers, Keir. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python on Nintendo DS

2005-12-21 Thread Do Re Mi chel La Si Do
Hi! Super mega cool. Thanks! MCI -- http://mail.python.org/mailman/listinfo/python-list

Re: Easiest way to calculate number of character in string

2005-12-21 Thread Carsten Haese
On Wed, 2005-12-21 at 09:03, P. Schmidt-Volkmar wrote: > Hi there, > > I have a string in which I want to calculate how often the character ';' > occurs. If the character does not occur 42 times, the ";" should be added so > the 42 are reached. > > My solution is slow and wrong: > for Posi

Re: Easiest way to calculate number of character in string

2005-12-21 Thread claude . henchoz
should = 42 has = Zeile.count(';') if has < should: Zeile += ";"*(should - has) cheers, claude -- http://mail.python.org/mailman/listinfo/python-list

Re: Easiest way to calculate number of character in string

2005-12-21 Thread Lawrence Oluyede
Il 2005-12-21, P. Schmidt-Volkmar <[EMAIL PROTECTED]> ha scritto: > Hi there, > > I have a string in which I want to calculate how often the character ';' > occurs. If the character does not occur 42 times, the ";" should be added so > the 42 are reached. > > My solution is slow and wrong: >

Re: Easiest way to calculate number of character in string

2005-12-21 Thread Kent Johnson
P. Schmidt-Volkmar wrote: > Hi there, > > I have a string in which I want to calculate how often the character ';' > occurs. If the character does not occur 42 times, the ";" should be added so > the 42 are reached. > > My solution is slow and wrong: > > How can this be achieved easily? Is t

Re: Which Python web framework is most like Ruby on Rails?

2005-12-21 Thread Scott David Daniels
Richie Hindle wrote: > You will hear valid arguments for GPL, LGPL, BSD and other licenses (though > the Python license is unsuitable for anything other than Python - see > http://wiki.python.org/moin/PythonSoftwareFoundationLicenseFaq) > > A good solution would be multiple-licensing. You state t

Re: libxml2 and mindom

2005-12-21 Thread Paul Boddie
ankit wrote: > I am parsing xml file using libxml2 and for navigating the document > object tree I want to use minidom. Is it possible. Can anyone give me > any example for the same ? Try libxml2dom [1] if you want to use a minidom-style API on documents parsed by libxml2. Recent namespace discus

Re: numarray :: multiplying all the elements in 1d array

2005-12-21 Thread Tim Hochberg
Mandus wrote: > Tue, 20 Dec 2005 19:32:13 +0530 skrev Suresh Jeevanandam: > >>Hi all, >> Lets say I have an array: >> from numarray import * >> a = array([ 6, 7, 8, 9, 10, 11, 12]) >> >> I want to multiply out all the elements and get the result. >> >> r = 1.0 >>

Re: parsing engineering symbols

2005-12-21 Thread Bengt Richter
On Tue, 20 Dec 2005 23:28:12 +0100, "Fredrik Lundh" <[EMAIL PROTECTED]> wrote: >Suresh Jeevanandam wrote: > >> I want to convert a string to float value. The string contains >> engineering symbols. >> >> For example, >> >> s = '12k' >> >> I want some function which would return 12000 >> function(s

Re: coverting EST to PST

2005-12-21 Thread Tim Williams (gmail)
On 21 Dec 2005 03:15:47 -0800, Narendra < [EMAIL PROTECTED]> wrote: Hi All,i got a problem. I need to convert time from EST standard to PSTstandard.Thu, 15 Dec 2005 09:24:19 -0500 to PST Quick and dirty,   might not work for times at the end of DST >>> import time >>> from email import Utils >>>

Re: How to check if a string "is" an int?

2005-12-21 Thread Steven D'Aprano
On Wed, 21 Dec 2005 05:15:23 -0800, bonono wrote: > > Steven D'Aprano wrote: >> If you really wanted to waste CPU cycles, you could do this: >> >> s = "1579" >> for c in s: >> if not c.isdigit(): >> print "Not an integer string" >> break >> else: >> # if we get here, we di

Re: How to check if a string "is" an int?

2005-12-21 Thread Daniel Schüle
[EMAIL PROTECTED] wrote: > How do I check if a string contains (can be converted to) an int? I > want to do one thing if I am parsing and integer, and another if not. > > /David > others already answered, this is just an idea >>> def isNumber(n): ... import re ... if re.match("^[-+]?[0

Re: parsing engineering symbols

2005-12-21 Thread Dave Hansen
On Wed, 21 Dec 2005 19:10:21 +0530 in comp.lang.python, Suresh Jeevanandam <[EMAIL PROTECTED]> wrote: [re: SI prefixes] > >Exactly what I wanted. > >It would be nice if the standard float function takes care of these. No, it wouldn't. Regards, -=Dave --

Re: type error on porting outfile.write

2005-12-21 Thread Dave Hansen
On Tue, 20 Dec 2005 22:11:01 -0500 in comp.lang.python, Eric McCoy <[EMAIL PROTECTED]> wrote: >[EMAIL PROTECTED] wrote: >> I ported my code from the development to >> application platform, I found a "type error" >> on a fileout statement: > >> outfile.write(object.id +",") > >What is the type of o

Reducing import try/except boilerplate

2005-12-21 Thread Nick Coghlan
Several standard library modules (e.g., cPickle/pickle, cStringIO/StringIO, threading/dummy_threading) have versions which may not be available on all platforms, and pure Python fallbacks that work on any platform Python supports. Flicking through the latest version of the Python Cookbook, I no

Re: Easiest way to calculate number of character in string

2005-12-21 Thread Ove Svensson
"P. Schmidt-Volkmar" <[EMAIL PROTECTED]> writes: > Hi there, > > I have a string in which I want to calculate how often the character ';' > occurs. If the character does not occur 42 times, the ";" should be added so > the 42 are reached. > > My solution is slow and wrong: > for Position

Re: Easiest way to calculate number of character in string

2005-12-21 Thread Ove Svensson
Ove Svensson <[EMAIL PROTECTED]> writes: > "P. Schmidt-Volkmar" <[EMAIL PROTECTED]> writes: > > > Hi there, > > > > I have a string in which I want to calculate how often the character ';' > > occurs. If the character does not occur 42 times, the ";" should be added > > so > > the 42 are rea

Re: Which Python web framework is most like Ruby on Rails?

2005-12-21 Thread Pierre Quentel
In Karrigell the scripts are executed in a namespace prepared by the framework, with HTTP environment, form data, the functions and exceptions for authentication, session management, redirection etc. I suppose that this falls into the first category above, "modules (that) are designed to run linked

Re: Which Python web framework is most like Ruby on Rails?

2005-12-21 Thread Martin Christensen
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 > "Kent" == Kent Johnson <[EMAIL PROTECTED]> writes: Kent> [Karrigell is GPL'ed] Unfortunately this makes it impossible for Kent> me to consider using Karrigell in my work. I recently needed a Kent> stand-alone web server for a small in-house proje

Re: Which Python web framework is most like Ruby on Rails?

2005-12-21 Thread Martin Christensen
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 > "Ben" == Ben Sizer <[EMAIL PROTECTED]> writes: Ben> Unfortunately, that doesn't really satisfy the GPL's concerns. Ben> The work arguably "contains or is derived from" Karrigell, which Ben> is explicitly covered in section 2b of the GPL. If you s

Re: How to check if a string "is" an int?

2005-12-21 Thread Steven D'Aprano
On Wed, 21 Dec 2005 16:39:19 +0100, Daniel Schüle wrote: > [EMAIL PROTECTED] wrote: >> How do I check if a string contains (can be converted to) an int? I >> want to do one thing if I am parsing and integer, and another if not. >> >> /David >> > > others already answered, this is just an idea >

Re: Which Python web framework is most like Ruby on Rails?

2005-12-21 Thread Kent Johnson
Martin Christensen wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > >>"Kent" == Kent Johnson <[EMAIL PROTECTED]> writes: > > Kent> [Karrigell is GPL'ed] Unfortunately this makes it impossible for > Kent> me to consider using Karrigell in my work. I recently needed a > Kent> stand

Newbie: adding string values to a list?

2005-12-21 Thread planetthoughtful
Hi All, Sorry for the influx of newbie questions -- I'm trying to figure these things out on my own before bothering the community, but a lot of bits and pieces are escaping me at the moment. I'm retrieving a result set from an SQLite db (using the APSW module) and I want to add the value from on

Re: Newbie: adding string values to a list?

2005-12-21 Thread Duncan Booth
planetthoughtful wrote: > result = [] > for name in cursor.execute("SELECT name, address FROM contacts ORDER BY > name"): > result.extend(name) > > print result > > For reasons I (obviously) don't understand, the "name" values get > broken up into each individual letter of the values in the

Re: Newbie: adding string values to a list?

2005-12-21 Thread Tim N. van der Leeuw
You need to use result.append(...) instead of result.extend(...) (Been stumped with that myself too, several times, when I was still a newby... Except was using the operator '+=' I think) cheers, --Tim -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie: adding string values to a list?

2005-12-21 Thread bonono
planetthoughtful wrote: > Hi All, > > Sorry for the influx of newbie questions -- I'm trying to figure these > things out on my own before bothering the community, but a lot of bits > and pieces are escaping me at the moment. > > I'm retrieving a result set from an SQLite db (using the APSW module

Re: Which Python web framework is most like Ruby on Rails?

2005-12-21 Thread Robert Kern
Martin Christensen wrote: > >>>"Kent" == Kent Johnson <[EMAIL PROTECTED]> writes: > > Kent> [Karrigell is GPL'ed] Unfortunately this makes it impossible for > Kent> me to consider using Karrigell in my work. I recently needed a > Kent> stand-alone web server for a small in-house project that

Re: Is it possible to use python to unit test C++ code?

2005-12-21 Thread keirr
[EMAIL PROTECTED] wrote: > Is it possible to use python to unit test C++ code? If yes, is there > any example available? > If I had to use python to test C++ code, I'd use the Boost python library: http://www.boost.org/libs/python/doc/ to expose my C++ classes, and write the unittests in python af

memory usage of a specific function

2005-12-21 Thread Hermann Maier
hi, i need to find out the memory usage of a specific function that i use in my program. this function does some recursive calculations and i want my program to display the amount of memory the function used to calculate a specific value. thx -- http://mail.python.org/mailman/listinfo/python-

Re: Newbie: adding string values to a list?

2005-12-21 Thread Larry Bates
planetthoughtful wrote: > Hi All, > > Sorry for the influx of newbie questions -- I'm trying to figure these > things out on my own before bothering the community, but a lot of bits > and pieces are escaping me at the moment. > > I'm retrieving a result set from an SQLite db (using the APSW modul

Re: How to check if a string "is" an int?

2005-12-21 Thread Dave Hansen
On Thu, 22 Dec 2005 01:41:34 +1100 in comp.lang.python, Steven D'Aprano <[EMAIL PROTECTED]> wrote: [...] >Well, let's find out, shall we? [...] >A small but consistent speed advantage to the try...except block. > >Having said all that, the speed difference are absolutely trivial, less >than 0.1 mi

Re: Easiest way to calculate number of character in string

2005-12-21 Thread Bengt Richter
On 21 Dec 2005 15:57:35 +0100, Ove Svensson <[EMAIL PROTECTED]> wrote: >Ove Svensson <[EMAIL PROTECTED]> writes: > >> "P. Schmidt-Volkmar" <[EMAIL PROTECTED]> writes: >> >> > Hi there, >> > >> > I have a string in which I want to calculate how often the character ';' >> > occurs. If the charac

Re: Is it possible to use python to unit test C++ code?

2005-12-21 Thread skip
sylcheung> Is it possible to use python to unit test C++ code? If yes, sylcheung> is there any example available? Yes, it's quite possible. Some people even do it. ;-) As for examples, take a look at Python's own test suite. Much of the code it contains actually tests modules written in

Re: libxml2 and mindom

2005-12-21 Thread ankit
Hi Paul, I checked for it and here are my comments on it: libxml2dom has Alpha release . So there may be some bugs in it. In our project we cant take risk to move back after deciding for one. Thanks for your reply. I checked some other options like libgdome2. Can you make some comments on that? Th

Re: Raw images

2005-12-21 Thread Tuvas
That did the trick, I can now remove the bad tag statement, and it all works just nicely. Thank you very much! -- http://mail.python.org/mailman/listinfo/python-list

Resizing of PIL images

2005-12-21 Thread Tuvas
I am seeking a way to resize a PIL image, even if the original is a smaller dimention than the new size. Resizing seems to only make an image smaller, and not larger. I have a 700x700 sized picture, sometimes that will display an image larger and other times smaller. Is there an easy way to do this

  1   2   >