Re: Google Code Jam language usage

2009-09-15 Thread Bearophile
(If you see any error in what I have written here, please tell me.) So far I've never done a Google Code Jam. There are 12 problems there (G.C.Jam 2009), and the best solutions are 9 in C++ and 3 in C (I think they are the best solutions, but I am not sure). The code of all such best solutions is

Re: python decimals

2009-09-15 Thread Mark Dickinson
On Sep 15, 2:27 am, Andrew Svetlov wrote: > Is there some kind of python binding for decNumber library? > Standard decimal.Decimal is good enough, but very slow. > My current project toughly coupled with 'currency' operations and we > have performance problems related to decimal calculations. > Fr

Re: VT100 in Python

2009-09-15 Thread Grant Edwards
On 2009-09-14, Wolfgang Rohdewald wrote: > that should be easy using regular expressions And they say irony doesn't work well on Usenet! -- Grant Edwards grante Yow! My nose feels like a at bad Ronald Reagan movie ..

Re: An assessment of the Unicode standard

2009-09-15 Thread Christopher Culver
Robin Becker writes: > well allegedly, "the medium is the message" so we also need to take > account of language in addition to the meaning of communications. I > don't believe all languages are equivalent in the meanings that they > can encode or convey. Our mathematics is heavily biassed towards

Re: An assessment of the Unicode standard

2009-09-15 Thread r
On Sep 14, 1:24 pm, Terry Reedy wrote: > r wrote: > > > So how many letters do we need? 50, 100, 1000? > >  From Wikipedia IPA article: > Occasionally symbols are added, removed, or modified by the > International Phonetic Association. As of 2008, there are 107 distinct > letters, 52 diacritics, a

Re: numpy NaN, not surviving pickle/unpickle?

2009-09-15 Thread Mark Dickinson
On Sep 14, 4:05 pm, Scott David Daniels wrote: > Steven D'Aprano wrote: > > On Sun, 13 Sep 2009 17:58:14 -0500, Robert Kern wrote: > > Exactly -- there are 2**53 distinct floats on most IEEE systems, the vast > > majority of which might as well be "random". What's the point of caching > > numbers

Re: How to improve this code?

2009-09-15 Thread Hendrik van Rooyen
On Tuesday 15 September 2009 03:08:59 Oltmans wrote: > match=[1,2,3,4,5] > > def elementsPresent(aList): > result=False > if not aList: > return False > for e in aList: > if e in match: > result=True > else: >

Re: Remove empty strings from list

2009-09-15 Thread Bruno Desthuilliers
Helvin a écrit : Hi, Sorry I did not want to bother the group, but I really do not understand this seeming trivial problem. I am reading from a textfile, where each line has 2 values, with spaces before and between the values. I would like to read in these values, but of course, I don't want the

Re: Incremental project based programming guide

2009-09-15 Thread Hendrik van Rooyen
On Tuesday 15 September 2009 04:43:46 bouncy...@gmail.com wrote: > I was wondering if anyone had actually designed their programming text > around incremental parts of a project and then taken the results of the > project at each chapter and created something of value. specifically in > referwnce t

Re: An assessment of the Unicode standard

2009-09-15 Thread Hendrik van Rooyen
On Monday 14 September 2009 14:06:36 Christopher Culver wrote: > This is the old Sapir-Whorf hypothesis, which fell out of favour among > linguists half a century ago already. 1) Language does not constrain > human thought, and 2) any two human languages are both capable of > expressing the same t

Re: Remove empty strings from list

2009-09-15 Thread Bruno Desthuilliers
Dave Angel a écrit : (snip) As Chris says, you're modifying the list while you're iterating through it, and that's undefined behavior. Why not do the following? mylist = line.strip().split(' ') mylist = [item for item in mylist if item] Mmmm... because the second line is plain useless when

Re: Remove empty strings from list

2009-09-15 Thread Bruno Desthuilliers
Dennis Lee Bieber a écrit : (snip) All of which can be condensed into a simple for ln in f: wrds = ln.strip() # do something with the words -- no whitespace to be seen I assume you meant: wrds = ln.strip().split() ?-) -- http://

Re: Retracing your steps in an interactive python env

2009-09-15 Thread Bernhard Voigt
On Sep 14, 9:52 pm, Jack Norton wrote: > Anyway, I have created a function using def, and well, I like the way it > is working, however...  I have already filled the command line history > buffer (the com.exe buffer?) so _what_ I actually filled this def with > is lost.  Now, it isn't that compli

PyQT Qthread stuck main app

2009-09-15 Thread daved170
Hi everybody, I've got a simple GUI app written in python and pyqt. I'm having 2 buttons - "start" and "stop" start calls a function that start a thread and stop stops it. my problem is that when start is pusshed the entire window stuck and it's impossible to push the STOP button and even when it

How to define a class that can act as dictionary key?

2009-09-15 Thread Lambda
Hi, I'd like to define a class to use it as a dictionary key: class dict_entry: def __init__(self, term = "", doc_freq = 0): self.term = term self.doc_freq = doc_freq def __cmp__(self, entry): return isinstance(entry, dict_entry) and cmp(self.term, entry.term) def __str__(self

Re: Google Code Jam language usage

2009-09-15 Thread Bearophile
> (There can be ways to speed up this Python code, I have not tried to > use a 1D matrix with shifts to find the right starting of the rows as > in C, and often in such dynamic programming algorithms you can just > keep 2 rows to avoid storing the whole dynamic matrix, this saves > memory and speed

Re: How to define a class that can act as dictionary key?

2009-09-15 Thread Paul Rubin
Lambda writes: > When I run it, it says "TypeError: unhashable instance" > > It looks like I can't use the new class object as the dictionary key. > What should I do? You have to add a __hash__ method. Untested: def __hash__(self): return (self.term, self.doc_freq) is probably the easiest

Re: How to define a class that can act as dictionary key?

2009-09-15 Thread Xavier Ho
On Tue, Sep 15, 2009 at 9:47 PM, Lambda wrote: > When I run it, it says "TypeError: unhashable instance" > > I believe you need to implement __hash__() for the class. Make sure your class returns a unique identifier for a certain value. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to define a class that can act as dictionary key?

2009-09-15 Thread Christian Heimes
Paul Rubin schrieb: > Lambda writes: >> When I run it, it says "TypeError: unhashable instance" >> >> It looks like I can't use the new class object as the dictionary key. >> What should I do? > > You have to add a __hash__ method. Untested: > > def __hash__(self): return (self.term, self.d

Re: VTK install

2009-09-15 Thread Francesco Bochicchio
On Sep 15, 6:29 am, Gib wrote: > As part of the MayaVi install, I need to install VTK.   ... > Since VTK appears to be installed, I'm guessing that either the path > setting is wrong, or python is not using PYTHONPATH.  How can I check > that PYTHONPATH is being used? The paths in PYTHONPATH sh

Re: How to define a class that can act as dictionary key?

2009-09-15 Thread Paul Rubin
Christian Heimes writes: > > def __hash__(self): return (self.term, self.doc_freq) > > > > is probably the easiest. > > The __hash__ function must return an integer: Oh oops. Try: def __hash__(self): return hash((self.term, self.doc_freq)) -- http://mail.python.org/mailman/listinfo/py

str.split() with empty separator

2009-09-15 Thread Ulrich Eckhardt
Hi! "'abc'.split('')" gives me a "ValueError: empty separator". However, "''.join(['a', 'b', 'c'])" gives me "'abc'". Why this asymmetry? I was under the impression that the two would be complementary. Uli -- Sator Laser GmbH Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932 -

Re: PyQT Qthread stuck main app

2009-09-15 Thread David Boddie
On Tue Sep 15 12:59:35 CEST 2009, daved170 wrote: > my problem is that when start is pusshed the entire window stuck and > it's impossible to push the STOP button and even when it looks like > it's been pushed it actually don't do anything. > > any idea how to fix it? Does adding a call to the ba

Re: How to define a class that can act as dictionary key?

2009-09-15 Thread Bruno Desthuilliers
Lambda a écrit : Hi, I'd like to define a class to use it as a dictionary key: Others already answered (define the __hash__ method). Just one point: the value returned by the __hash__ method should not change for the lifetime of the object. So if you use instance attributes to compute the

Re: str.split() with empty separator

2009-09-15 Thread Xavier Ho
On Tue, Sep 15, 2009 at 10:31 PM, Ulrich Eckhardt wrote: > "'abc'.split('')" gives me a "ValueError: empty separator". > However, "''.join(['a', 'b', 'c'])" gives me "'abc'". > > Why this asymmetry? I was under the impression that the two would be > complementary. > I'm not sure about asymmetry,

preferred way to set encoding for print

2009-09-15 Thread _wolf
hi folks, i am doing my first steps in the wonderful world of python 3. some things are good. some things have to be relearned. some things drive me crazy. sadly, i'm working on a windows box. which, in germany, entails that python thinks it to be a good idea to take cp1252 as the default encodi

Re: str.split() with empty separator

2009-09-15 Thread Dave Angel
Ulrich Eckhardt wrote: Hi! "'abc'.split('')" gives me a "ValueError: empty separator". However, "''.join(['a', 'b', 'c'])" gives me "'abc'". Why this asymmetry? I was under the impression that the two would be complementary. Uli I think the problem is that join() is lossy; if you try "".

LinkedIn Messages, 9/15/2009

2009-09-15 Thread LinkedIn Communication
LinkedIn REMINDERS: Invitation Reminders: * View Invitation from Tim Heath http://www.linkedin.com/e/I2LlXdLlWUhFABKmxVOlgGLlWUhFAfhMPPF/blk/I287618177_3/0PnPsTcjwNdzsUcAALqnpPbOYWrSlI/svi/ * View Invitation from Navneet Khanna http://www.linkedin.c

ANN: OpenOpt 0.25 - free Python-written numerical optimization framework with automatic differentiation

2009-09-15 Thread dmitrey
OpenOpt is cross-platform (Windows, Linux, Mac OS etc) Python-written framework. If you have a model written in FuncDesigner (http:// openopt.org/FuncDesigner), you can get 1st derivatives via automatic differentiation (http://en.wikipedia.org/wiki/ Automatic_differentiation) (some examples here: h

ANN: FuncDesigner 0.15 - free Python-written framework with automatic differentiation

2009-09-15 Thread dmitrey
FuncDesigner is cross-platform (Windows, Linux, Mac OS etc) Python- written framework with automatic differentiation (http:// en.wikipedia.org/wiki/Automatic_differentiation). License BSD allows to use it in both open- and closed-code soft. It has been extracted from OpenOpt framework as a stand-al

Re: str.split() with empty separator

2009-09-15 Thread Vlastimil Brom
2009/9/15 Ulrich Eckhardt : > Hi! > > "'abc'.split('')" gives me a "ValueError: empty separator". > However, "''.join(['a', 'b', 'c'])" gives me "'abc'". > > Why this asymmetry? I was under the impression that the two would be > complementary. > > Uli > maybe it isn't quite obvious, what the behav

Re: PyQT Qthread stuck main app

2009-09-15 Thread daved170
On Sep 15, 2:54 pm, David Boddie wrote: > On Tue Sep 15 12:59:35 CEST 2009, daved170 wrote: > > > my problem is that when start is pusshed the entire window stuck and > > it's impossible to push the STOP button and even when it looks like > > it's been pushed it actually don't do anything. > > > a

Python and flash charts

2009-09-15 Thread Massi
Hi everyone, I'm trying to incorporate in my script flash charts like those of yahoo finance (for example this: http://it.finance.yahoo.com/echarts?s=^DJI#symbol=^DJI;range=1d), possibly using wxpython. Does anybody have any idea on how to do that? Thanks in advance. -- http://mail.python.org/mail

Re: Remove empty strings from list

2009-09-15 Thread Sion Arrowsmith
Bruno Desthuilliers wrote: > >> mylist = line.strip().split() > >will already do the RightThing(tm). So will mylist = line.split() -- \S under construction -- http://mail.python.org/mailman/listinfo/python-list

How to check something is in a list with rich-comparison objects?

2009-09-15 Thread Jason
Comparing a string to the enumerations in pysvn gives me an attribute error, because they've overloaded the rich compare methods: >>> import pysvn >>> "string" in [pysvn.wc_notify_action.status_completed, "string"] Traceback (most recent call last): File "", line 1, in AttributeError: expecting

Re: Why use "locals()"

2009-09-15 Thread Sion Arrowsmith
Sean DiZazzo wrote: >> def print_item(item): >>      description = textwrap.fill(item.description, 40) >>      short = item.description.split('\n', 1)[0] >>      code = str(item.id).zfill(6) >>      print "%(code)s %(short)s\n%(description)s\n" % locals() > >I see the use of that, but according t

Retrieve url's of all jpegs at a web page URL

2009-09-15 Thread grimmus
Hi, I would like to achieve something like Facebook has when you post a link. It shows images located at the URL you entered so you can choose what one to display as a summary. I was thinking i could loop through the html of a page with a regex and store all the jpeg url's in an array. Then, i co

python 3.1 unicode question

2009-09-15 Thread jeffunit
I wrote a program that diffs files and prints out matching file names. I will be executing the output with sh, to delete select files. Most of the files names are plain ascii, but about 10% of them have unicode characters in them. When I try to print the string containing the name, I get an excep

weird str error

2009-09-15 Thread daved170
Hi everybody, I'm using SPE 0.8.3.c as my python editor. I'm using the str() function and i got a very odd error. I'm trying to do this: print str("HI") When i'm writing this line in the shell it prints: HI When it's in my code (it's the only line) i'm getting the following error: file "c:\Python

Re: Python and flash charts

2009-09-15 Thread Benjamin Kaplan
On Tue, Sep 15, 2009 at 10:06 AM, Massi wrote: > > Hi everyone, I'm trying to incorporate in my script flash charts like > those of yahoo finance (for example this: > http://it.finance.yahoo.com/echarts?s=^DJI#symbol=^DJI;range=1d), > possibly using wxpython. Does anybody have any idea on how to d

Re: How to improve this code?

2009-09-15 Thread Oltmans
On Sep 15, 1:13 pm, Hendrik van Rooyen wrote: > > (i) a True if All the elements in match are in aList, else False? > (ii) a True if any one or more of the members of match are in aList? > (iii) Something else? That's a good question because I failed miserably in explaining my problem clearl

Re: Incremental project based programming guide

2009-09-15 Thread John Haggerty
On Tue, Sep 15, 2009 at 2:22 AM, Hendrik van Rooyen wrote: > On Tuesday 15 September 2009 04:43:46 bouncy...@gmail.com wrote: > > I was wondering if anyone had actually designed their programming text > > around incremental parts of a project and then taken the results of the > > project at each

Re: overrideredirect vs. text entry etc. widget

2009-09-15 Thread Sean DiZazzo
On Sep 14, 10:43 pm, kernus wrote: > I just googled this post: > > http://mail.python.org/pipermail/python-list/2006-September/575832.html > > something like: > > from Tkinter import * > > root = Tk() > Entry(root).pack() > Button(root, text='Quit', command=sys.exit).pack() > root.overrideredirect

Re: MayaVi install

2009-09-15 Thread Robert Kern
On 2009-09-14 23:07 PM, Gib wrote: I am trying to follow the instructions for installing MayaVi given on the Enthought site: http://code.enthought.com/projects/mayavi/docs/development/html/mayavi/installation.html I'm following the step-by-step instructions to install with eggs under Windows. W

Re: PyQT Qthread stuck main app

2009-09-15 Thread Dave Angel
daved170 wrote: On Sep 15, 2:54 pm, David Boddie wrote: On Tue Sep 15 12:59:35 CEST 2009, daved170 wrote: my problem is that when start is pusshed the entire window stuck and it's impossible to push the STOP button and even when it looks like it's been pushed it actually don't do anyt

cx_Oracle problem

2009-09-15 Thread Squid
It's time for another round of "stump-the-geek". (thats what we call it in my office) If actual code is needed I can provide but lets start off small for this one... I've got a Python script that uses cx_Oracle to access an Oracle DB. running the script from command line runs perfect running the

Re: cx_Oracle problem

2009-09-15 Thread Squid
On Sep 15, 9:45 am, Squid wrote: > It's time for another round of "stump-the-geek". (thats what we call > it in my office) > > If actual code is needed I can provide but lets start off small for > this one... > > I've got a Python script that uses cx_Oracle to access an Oracle DB. > running the sc

Re: How to improve this code?

2009-09-15 Thread Sol Toure
def are_elements_present(sourceList, searchList):for e in searchList: if e not in sourceList: return False return True Using set: def are_elements_present(sourceList, searchList): return len(set(sourceList).intersection(set(searchList)) == len(searchLis

Re: How to improve this code?

2009-09-15 Thread Tim Golden
Sol Toure wrote: def are_elements_present(sourceList, searchList):for e in searchList: if e not in sourceList: return False return True Using set: def are_elements_present(sourceList, searchList): return len(set(sourceList).intersection(set(searchList

Re: How to improve this code?

2009-09-15 Thread Tim Golden
Tim Golden wrote: Unless I'm missing something, (and I didn't bother to read the original code so I may be) that's a subset test: set (searchList) <= set (searchList) (cough) or, rather: set (searchList) <= set (sourceList) TJG -- http://mail.python.org/mailman/listinfo/python-list

Re: An assessment of the Unicode standard

2009-09-15 Thread Christopher Culver
Hendrik van Rooyen writes: > 2) Is about as useful as stating that any Turing complete language and > processor pair is capable of solving any computable problem, given enough > time. So why are we not all programming in brainfuck? Except the amount of circumlocution one language might happen t

Re: str.split() with empty separator

2009-09-15 Thread MRAB
Vlastimil Brom wrote: 2009/9/15 Ulrich Eckhardt : Hi! "'abc'.split('')" gives me a "ValueError: empty separator". However, "''.join(['a', 'b', 'c'])" gives me "'abc'". Why this asymmetry? I was under the impression that the two would be complementary. Uli maybe it isn't quite obvious, what

Re: weird str error

2009-09-15 Thread Peter Otten
daved170 wrote: > Hi everybody, > I'm using SPE 0.8.3.c as my python editor. > I'm using the str() function and i got a very odd error. > > I'm trying to do this: print str("HI") > When i'm writing this line in the shell it prints: HI > When it's in my code (it's the only line) i'm getting the fo

Re: weird str error

2009-09-15 Thread Dave Angel
daved170 wrote: Hi everybody, I'm using SPE 0.8.3.c as my python editor. I'm using the str() function and i got a very odd error. I'm trying to do this: print str("HI") When i'm writing this line in the shell it prints: HI When it's in my code (it's the only line) i'm getting the following error

Re: Re: How to improve this code?

2009-09-15 Thread Dave Angel
Oltmans wrote: On Sep 15, 1:13 pm, Hendrik van Rooyen wrote: (i) a True if All the elements in match are in aList, else False? (ii) a True if any one or more of the members of match are in aList? (iii) Something else? That's a good question because I failed miserably in explainin

Re: An assessment of the Unicode standard

2009-09-15 Thread Hyuga
On Sep 14, 5:05 am, Christopher Culver wrote: > Hyuga writes: > > I just wanted to add, in defense of the Chinese written language > > ... that I think it would make a fairly good candidate for use at > > least as a universal *written* language.  Particularly simplified > > Chinese since, well, i

Re: An assessment of the Unicode standard

2009-09-15 Thread r
On Sep 15, 4:12 am, Hendrik van Rooyen wrote: (snip) > When a language lacks a word for a concept like "window", then (I > believe  :-) ), it kind of puts a crimp in the style of thinking that a > person will do, growing up with only that language. Are you telling us people using a language that

Re: How to improve this code?

2009-09-15 Thread Andreas Waldenburger
On Mon, 14 Sep 2009 18:33:17 -0700 (PDT) André wrote: > Here's an example using sets: > > >>> def is_present(list_1, list_2): > ...if set(list_1).intersection(set(list_2)): > ... return True > ...return False > ... Not that it matters, but I'd probably write: def is_present(test,

Looking for a pure Python chart drawing module

2009-09-15 Thread John Nagle
I'm looking for something that can draw simple bar and pie charts in Python. I'm trying to find a Python package, not a wrapper for some C library, as this has to run on both Windows and Linux and version clashes are a problem. Here's the list from the Python wiki at "http://wiki.python.org/moin

Re: Looking for a pure Python chart drawing module

2009-09-15 Thread Vlastimil Brom
2009/9/15 John Nagle : > I'm looking for something that can draw simple bar and pie charts > in Python.  I'm trying to find a Python package, not a wrapper for > some C library, as this has to run on both Windows and Linux > and version clashes are a problem. > > Here's the list from the Python wik

KeyBoard interrupt and Redirection operator

2009-09-15 Thread aditya shukla
Hello Guys, I have a program which i use like this scraps.py arg1 arg2 > filename. I am using the redirection operator to direct the output to the filename .The scenario here is that I want to print a message as long as the program is running and as generate an error message and exit as I use a k

Re: How to check something is in a list with rich-comparison objects?

2009-09-15 Thread Gabriel Genellina
En Tue, 15 Sep 2009 11:18:33 -0300, Jason escribió: Comparing a string to the enumerations in pysvn gives me an attribute error, because they've overloaded the rich compare methods: import pysvn "string" in [pysvn.wc_notify_action.status_completed, "string"] Traceback (most recent call las

Trouble with MySQLdb

2009-09-15 Thread Chris
I'm receiving the following error: Traceback (most recent call last): File "db.py", line 189, in rows = db.get("SELECT * FROM survey") File "db.py", line 55, in get self.sql(query) File "db.py", line 47, in sql return self.cursor.execute(query) File "build/bdist.linux-i686/e

Re: Why use "locals()"

2009-09-15 Thread Gabriel Genellina
En Tue, 15 Sep 2009 11:18:35 -0300, Sion Arrowsmith escribió: Sean DiZazzo wrote: What I'm not clear about is under what circumstances locals() does not produce the same result as vars() . py> help(vars) Help on built-in function vars in module __builtin__: vars(...) vars([object])

Re: KeyBoard interrupt and Redirection operator

2009-09-15 Thread Gabriel Genellina
En Tue, 15 Sep 2009 15:10:48 -0300, aditya shukla escribió: I have a program which i use like this scraps.py arg1 arg2 > filename. I am using the redirection operator to direct the output to the filename .The scenario here is that I want to print a message as long as the program is runn

Re: KeyBoard interrupt and Redirection operator

2009-09-15 Thread Gary Herron
aditya shukla wrote: Hello Guys, I have a program which i use like this scraps.py arg1 arg2 > filename. I am using the redirection operator to direct the output to the filename .The scenario here is that I want to print a message as long as the program is running and as generate an error me

ActiveState Python 2.5 doesn't work via ssh?

2009-09-15 Thread Grant Edwards
Does anybody have any idea why Active State Python 2.5 works fine from a normal Cygwin shell window, but hangs when I try to start it when I'm ssh'd into the machine? -- Grant Edwards grante Yow! I don't know WHY I at s

Re: Looking for a pure Python chart drawing module

2009-09-15 Thread ici
On Sep 15, 8:25 pm, John Nagle wrote: > I'm looking for something that can draw simple bar and pie charts > in Python.  I'm trying to find a Python package, not a wrapper for > some C library, as this has to run on both Windows and Linux > and version clashes are a problem. > > Here's the list fro

subprocess woes

2009-09-15 Thread kj
I'm trying to write a function, sort_data, that takes as argument the path to a file, and sorts it in place, leaving the last "sentinel" line in its original position (i.e. at the end). Here's what I have (omitting most error-checking code): def sort_data(path, sentinel='.\n'): tmp_fd, tmp

Re: KeyBoard interrupt and Redirection operator

2009-09-15 Thread Dave Angel
aditya shukla wrote: Hello Guys, I have a program which i use like this scraps.py arg1 arg2 > filename. I am using the redirection operator to direct the output to the filename .The scenario here is that I want to print a message as long as the program is running and as generate an error messag

Upcoming Python/Django Classes

2009-09-15 Thread Steve Holden
Holden Web is please to announce a public "Introduction to Python" class, near Washington DC, on October 13-15, presented by Steve Holden. This is followed, on Friday October 16, by a one-day "Django Master Class" presented by Jacob Kaplan-Moss. Further details are available from http://holden

Re: ActiveState Python 2.5 doesn't work via ssh?

2009-09-15 Thread TerryP
On Sep 15, 7:20 pm, Grant Edwards wrote: > Does anybody have any idea why Active State Python 2.5 works > fine from a normal Cygwin shell window, but hangs when I try to > start it when I'm ssh'd into the machine? > Mixing normal Windows and Cygwin programs can sometimes yield odd results. The on

Re: subprocess woes

2009-09-15 Thread Mike Driscoll
On Sep 15, 2:26 pm, kj wrote: > I'm trying to write a function, sort_data, that takes as argument > the path to a file, and sorts it in place, leaving the last "sentinel" > line in its original position (i.e. at the end).  Here's what I > have (omitting most error-checking code): > > def sort_data

Re: subprocess woes

2009-09-15 Thread Christian Heimes
Mike Driscoll wrote: > You can use cStringIO to create a "file-like" object in memory: > > http://docs.python.org/library/stringio.html No, you can't with subprocess. The underlying operating system API requires a file descriptor of a real file. Christian -- http://mail.python.org/mailman/list

Re: An assessment of the Unicode standard

2009-09-15 Thread Terry Reedy
Christopher Culver wrote: Robin Becker writes: well allegedly, "the medium is the message" so we also need to take account of language in addition to the meaning of communications. I don't believe all languages are equivalent in the meanings that they can encode or convey. Our mathematics is he

Re: python decimals

2009-09-15 Thread Terry Reedy
Mark Dickinson wrote: On Sep 15, 2:27 am, Andrew Svetlov wrote: Is there some kind of python binding for decNumber library? Standard decimal.Decimal is good enough, but very slow. My current project toughly coupled with 'currency' operations and we have performance problems related to decimal c

Re: Looking for a pure Python chart drawing module

2009-09-15 Thread John Nagle
John Nagle wrote: I'm looking for something that can draw simple bar and pie charts in Python. I'm trying to find a Python package, not a wrapper for some C library, as this has to run on both Windows and Linux and version clashes are a problem. Here's the list from the Python wiki at "http://w

Application Packages

2009-09-15 Thread Dj Gilcrease
Say I have an application that lives in /usr/local/myapp it comes with some default plugins that live in /usr/local/myapp/plugins and I allow users to have plugins that would live in ~/myapp/plugins Is there a way to map ~/myapp to a user package so I could do "from user.plugins import *" or bette

unpacking vars from list of tuples

2009-09-15 Thread Ross
I'm inexperienced with some of the fancy list slicing syntaxes where python shines. If I have a list of tuples: k=[("a", "bob", "c"), ("p", "joe", "d"), ("x", "mary", "z")] and I want to pull the middle element out of each tuple to make a new list: myList = ["bob", "joe", "mary"] is there s

Re: unpacking vars from list of tuples

2009-09-15 Thread Chris Rebert
On Tue, Sep 15, 2009 at 2:51 PM, Ross wrote: > I'm inexperienced with some of the fancy list slicing syntaxes where > python shines. > > If I have a list of tuples: > >   k=[("a", "bob", "c"), ("p", "joe", "d"), ("x", "mary", "z")] > > and I want to pull the middle element out of each tuple to mak

Re: unpacking vars from list of tuples

2009-09-15 Thread Andre Engels
On Tue, Sep 15, 2009 at 11:51 PM, Ross wrote: > I'm inexperienced with some of the fancy list slicing syntaxes where > python shines. > > If I have a list of tuples: > >   k=[("a", "bob", "c"), ("p", "joe", "d"), ("x", "mary", "z")] > > and I want to pull the middle element out of each tuple to ma

Re: unpacking vars from list of tuples

2009-09-15 Thread Wolfram Hinderer
On 15 Sep., 23:51, Ross wrote: > If I have a list of tuples: > >    k=[("a", "bob", "c"), ("p", "joe", "d"), ("x", "mary", "z")] > > and I want to pull the middle element out of each tuple to make a new > list: > > myList = ["bob", "joe", "mary"] if a tuple is OK: zip(*k)[1] -- http://mail.pyth

Re: Why use "locals()"

2009-09-15 Thread Carl Banks
On Sep 15, 11:41 am, "Gabriel Genellina" wrote: > En Tue, 15 Sep 2009 11:18:35 -0300, Sion Arrowsmith   > escribió: > > > Sean DiZazzo   wrote: > > What I'm not clear about is under what circumstances locals() does > > not produce the same result as vars() . > > py> help(vars) > Help on built-in

Re: unpacking vars from list of tuples

2009-09-15 Thread Tim Chase
If I have a list of tuples: k=[("a", "bob", "c"), ("p", "joe", "d"), ("x", "mary", "z")] and I want to pull the middle element out of each tuple to make a new list: myList = ["bob", "joe", "mary"] is there some compact way to do that? I can imagine the obvious one of myList = [] for a in

Re: unpacking vars from list of tuples

2009-09-15 Thread Ross
On Sep 15, 6:00 pm, Andre Engels wrote: > On Tue, Sep 15, 2009 at 11:51 PM, Ross wrote: > > I'm inexperienced with some of the fancy list slicing syntaxes where > > python shines. > > > If I have a list of tuples: > > >   k=[("a", "bob", "c"), ("p", "joe", "d"), ("x", "mary", "z")] > > > and I wa

Re: VTK install

2009-09-15 Thread Gib
On Sep 16, 12:28 am, Francesco Bochicchio wrote: > On Sep 15, 6:29 am, Gib wrote: > > > As part of the MayaVi install, I need to install VTK.   > > ... > > > Since VTK appears to be installed, I'm guessing that either the path > > setting is wrong, or python is not using PYTHONPATH.  How can I ch

Re: MayaVi install

2009-09-15 Thread Gib
On Sep 16, 3:45 am, Robert Kern wrote: > On 2009-09-14 23:07 PM, Gib wrote: > > > I am trying to follow the instructions for installing MayaVi  given on > > the Enthought site: > >http://code.enthought.com/projects/mayavi/docs/development/html/mayav... > > I'm following the step-by-step instructio

Re: Looking for a pure Python chart drawing module

2009-09-15 Thread Ethan Furman
John Nagle wrote: http://home.gna.org/pychart/doc/introduction.html Tried PyChart. Set up for PNG file format. Got the error "Exception: Ghostscript not found."This thing just creates PostScript, then pumps it through GhostScript (anybody remember that?) to get other formats. And does

Re: Application Packages

2009-09-15 Thread Diez B. Roggisch
Dj Gilcrease schrieb: Say I have an application that lives in /usr/local/myapp it comes with some default plugins that live in /usr/local/myapp/plugins and I allow users to have plugins that would live in ~/myapp/plugins Is there a way to map ~/myapp to a user package so I could do "from user.pl

Re: LinkedIn Messages, 9/15/2009

2009-09-15 Thread Rhodri James
On Tue, 15 Sep 2009 14:39:04 +0100, LinkedIn Communication wrote: LinkedIn [snippety snip] Methinks the spam filter needs updating. -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: Remove empty strings from list

2009-09-15 Thread Rhodri James
On Tue, 15 Sep 2009 02:55:13 +0100, Chris Rebert wrote: On Mon, Sep 14, 2009 at 6:49 PM, Helvin wrote: Hi, Sorry I did not want to bother the group, but I really do not understand this seeming trivial problem. I am reading from a textfile, where each line has 2 values, with spaces before and

Fwd: Converting a script to Python 3 - having trouble.

2009-09-15 Thread Russell Jackson
Hi, I have the following code that works fine in Python 2.x, but I can't seem to get it to work in Python 3 with Popen. Can you please tell me how to get the same functionality out of Python 3? The gist of what I doing is in the setpassword function. I have tried numerous ways to get this to work,

Re: subprocess woes

2009-09-15 Thread kj
In Mike Driscoll writes: >On Sep 15, 2:26=A0pm, kj wrote: >> I'm trying to write a function, sort_data, that takes as argument >> the path to a file, and sorts it in place, leaving the last "sentinel" >> line in its original position (i.e. at the end). =A0Here's what I >> have (omitting most e

Re: subprocess woes

2009-09-15 Thread kj
Upon re-reading my post I realize that I left out some important details. In kj writes: >I'm trying to write a function, sort_data, that takes as argument >the path to a file, and sorts it in place, leaving the last "sentinel" >line in its original position (i.e. at the end). I neglected to

Re: Fwd: Converting a script to Python 3 - having trouble.

2009-09-15 Thread Rhodri James
On Wed, 16 Sep 2009 00:01:17 +0100, Russell Jackson wrote: Hi, I have the following code that works fine in Python 2.x, but I can't seem to get it to work in Python 3 with Popen. Can you please tell me how to get the same functionality out of Python 3? The gist of what I doing is in the

multiproccess: What is the Dameon flag?

2009-09-15 Thread Allen Fowler
Hello, What is the Daemon flag and when/why would I want to use it? Thank you, AF -- http://mail.python.org/mailman/listinfo/python-list

Re: subprocess woes

2009-09-15 Thread Chris Rebert
On Tue, Sep 15, 2009 at 12:26 PM, kj wrote: > I'm trying to write a function, sort_data, that takes as argument > the path to a file, and sorts it in place, leaving the last "sentinel" > line in its original position (i.e. at the end).  Here's what I > have (omitting most error-checking code): > >

Re: Looking for a pure Python chart drawing module

2009-09-15 Thread gerlos
John Nagle ha scritto: > I'm looking for something that can draw simple bar and pie charts > in Python. I'm trying to find a Python package, not a wrapper for > some C library, as this has to run on both Windows and Linux > and version clashes are a problem. > Did you look at matplotlib? In the

Re: Retrieve url's of all jpegs at a web page URL

2009-09-15 Thread Chris Rebert
On Tue, Sep 15, 2009 at 7:28 AM, grimmus wrote: > Hi, > > I would like to achieve something like Facebook has when you post a > link. It shows images located at the URL you entered so you can choose > what one to display as a summary. > > I was thinking i could loop through the html of a page with

Re: subprocess woes

2009-09-15 Thread kj
In Chris Rebert writes: >On Tue, Sep 15, 2009 at 12:26 PM, kj wrote: >> I'm trying to write a function, sort_data, that takes as argument >> the path to a file, and sorts it in place, leaving the last "sentinel" >> line in its original position (i.e. at the end). =C2=A0Here's what I >> have (o

  1   2   >