Re: stripping fields from xml file into a csv

2010-02-28 Thread Stefan Behnel
Hal Styli, 27.02.2010 21:50: > I have a sed solution to the problems below but would like to rewrite > in python... Note that sed (or any other line based or text based tool) is not a sensible way to handle XML. If you want to read XML, use an XML parser. They are designed to do exactly what you w

Paper Presentation Topics

2010-02-28 Thread jaagar
Paper Presentation Topics. Our database posses huge collection of topics for paper presentations in all areas. Check all our paper presentation topics at http://pptcontent.blogspot.com/ Topics for Paper Presentation : Paper presentation topics for ece. Paper presentation topics for cse. Pap

Re: Python dos2unix one liner

2010-02-28 Thread Steven D'Aprano
On Sat, 27 Feb 2010 19:37:50 -0800, staticd wrote: >> >Amusing how long those Python toes can be. In several replies I have >> >noticed (often clueless) opinions on Perl. When do people learn that a >> >language is just a tool to do a job? >> >> When do people learn that language makes a differenc

Re: help with Python installation

2010-02-28 Thread John Yeung
On Feb 28, 12:51 am, gujax wrote: > I agree with you. I have a CD of Xubuntu. I tried > booting up with the CD and was impressed. I noticed > few problems with screen resolution, window size etc. Though it may be worth working out any niggling problems to switch to Linux, I don't think you should

Re: Is this secure?

2010-02-28 Thread Paul Rubin
a...@pythoncraft.com (Aahz) writes: > Are you sure? I haven't done a lot of research, but my impression was > that Windows didn't have anything built in. I don't know much about the windows but there is the CAPI and then there is all the TCPA (i.e. DRM) stuff. Maybe it can be used somehow. -- h

getting rpy2 from repository

2010-02-28 Thread Stephen Tucker
Hi all, I have Enthought Python 4.3 installed on my OS X 10.5. When I do $ easy_install rpy2 Searching for rpy2 No matching release version found. Searching for latest development version. Reading http://www.enthought.com/repo/epd/eggs/MacOSX/10.4_x86/ Please enter credentials to access this repo

Re: Python dos2unix one liner

2010-02-28 Thread Stefan Behnel
Steven D'Aprano, 28.02.2010 09:48: > There ought to be some kind of competition for the least efficient > solution to programming problems That wouldn't be very interesting. You could just write a code generator that spits out tons of garbage code including a line that solves the problem, and the

Re: scope of generators, class variables, resulting in global na

2010-02-28 Thread dontspamleo
> > ...and really means this... > > class C: > >   x = 1 > >   def f(self,y): return T.x + y > > I don't understand what T is. Did you mean C? Yes, I meant C. Thanks. > > If so, you are wrong. self.x is not the same as .x due to > inheritance rules. Consider one example: > Thanks for the nice e

Re: Python dos2unix one liner

2010-02-28 Thread Martin P. Hellwig
On 02/28/10 11:05, Stefan Behnel wrote: Steven D'Aprano, 28.02.2010 09:48: There ought to be some kind of competition for the least efficient solution to programming problems That wouldn't be very interesting. You could just write a code generator that spits out tons of garbage code including

Re: stripping fields from xml file into a csv

2010-02-28 Thread Roland Mueller
Hello, 2010/2/28 Stefan Behnel > Hal Styli, 27.02.2010 21:50: > > I have a sed solution to the problems below but would like to rewrite > > in python... > > Note that sed (or any other line based or text based tool) is not a > sensible way to handle XML. If you want to read XML, use an XML parse

Re: stripping fields from xml file into a csv

2010-02-28 Thread Stefan Behnel
Roland Mueller, 28.02.2010 13:01: > The stylesheet is test.xsl and the insput data test.xml. The following > Python code the applies the stylesheet on the input data and puts the output > into foo. > > Python code: > #!/usr/bin/python > import sys > import libxml2 > import libxslt > > styledoc =

Method / Functions - What are the differences?

2010-02-28 Thread Michael Rudolf
Out of curiosity I tried this and it actually worked as expected: >>> class T(object): x=[] foo=x.append def f(self): return self.x >>> t=T() >>> t.f() [] >>> T.foo(1) >>> t.f() [1] >>> At first I thought "hehe, always fun to play around with pyt

Re: problem with floats and calculations

2010-02-28 Thread Albert van der Horst
In article , Dennis Lee Bieber wrote: >On Sun, 14 Feb 2010 10:33:54 +0100, Karsten Goen > declaimed the following in >gmane.comp.python.general: > >> Maybe anyone can help me with this problem, I don't want to generate for >> every possible user input a single formula. And also it should be possi

Re: stripping fields from xml file into a csv

2010-02-28 Thread Roland Mueller
2010/2/28 Stefan Behnel > Roland Mueller, 28.02.2010 13:01: > > The stylesheet is test.xsl and the insput data test.xml. The following > > Python code the applies the stylesheet on the input data and puts the > output > > into foo. > > > > Python code: > > #!/usr/bin/python > > import sys > > imp

Re: Python dos2unix one liner

2010-02-28 Thread John Bokma
Steven D'Aprano writes: > On Sat, 27 Feb 2010 11:27:04 -0600, John Bokma wrote: > >> When do people learn that a >> language is just a tool to do a job? > > When do people learn that there are different sorts of tools? A > professional wouldn't use a screwdriver when they need a hammer. [...]

Re: Method / Functions - What are the differences?

2010-02-28 Thread Alf P. Steinbach
* Michael Rudolf: Out of curiosity I tried this and it actually worked as expected: >>> class T(object): x=[] foo=x.append def f(self): return self.x >>> t=T() >>> t.f() [] >>> T.foo(1) >>> t.f() [1] >>> At first I thought "hehe, always fun to play around with p

Re: Method / Functions - What are the differences?

2010-02-28 Thread Rob Williscroft
Michael Rudolf wrote in news:hmdo3m$28...@news.urz.uni-heidelberg.de in comp.lang.python: > Note that all I did was moving the list and foo into the instance. Still > no self and no cls, but also no static behaviour any more. Yes in the first case foo was an attribute of the class, and in the s

cpan for python?

2010-02-28 Thread Someone Something
Is there something like cpan for python? I like python's syntax, but I use perl because of cpan and the tremendous modules that it has. -- http://mail.python.org/mailman/listinfo/python-list

Re: cpan for python?

2010-02-28 Thread sstein...@gmail.com
On Feb 28, 2010, at 9:28 AM, Someone Something wrote: > Is there something like cpan for python? I like python's syntax, but I use > perl because of cpan and the tremendous modules that it has. -- Please search the mailing list archives. This subject has been discussed to absolute death.

Printing the arguments of an attribute in a class

2010-02-28 Thread vsoler
I have a class that is a wrapper: class wrapper: def __init__(self, object): self.wrapped = object def __getattr__(self, attrname): print 'Trace: ', attrname #print arguments to attrname, how? return getattr(self.wrapped, attrname) I can run it this way: >

Re: Printing the arguments of an attribute in a class

2010-02-28 Thread Alf P. Steinbach
* vsoler: I have a class that is a wrapper: class wrapper: def __init__(self, object): self.wrapped = object def __getattr__(self, attrname): print 'Trace: ', attrname #print arguments to attrname, how? return getattr(self.wrapped, attrname) I can run it

Re: Printing the arguments of an attribute in a class

2010-02-28 Thread vsoler
On Feb 28, 4:00 pm, "Alf P. Steinbach" wrote: > * vsoler: > > > > > I have a class that is a wrapper: > > > class wrapper: > >     def __init__(self, object): > >         self.wrapped = object > >     def __getattr__(self, attrname): > >         print 'Trace: ', attrname > >         #print argumen

Re: cpan for python?

2010-02-28 Thread Daniel Fetchinson
> Is there something like cpan for python? I like python's syntax, but I use > perl because of cpan and the tremendous modules that it has. It's called PyPI or Cheese Shop: http://pypi.python.org/pypi Is it only me or others also mentally read C-SPAN when somebody writes CPAN? Cheers, Daniel

Re: Challenge: escape from the pysandbox

2010-02-28 Thread Victor Stinner
Le samedi 27 février 2010 18:37:22, Daniel Fetchinson a écrit : > It's google's hosting solution called app engine, for python web > applications: http://code.google.com/appengine/docs/python/gettingstarted/ > > I guess they also have some kind of a sandbox if they let people run > python on their

Re: stripping fields from xml file into a csv

2010-02-28 Thread Hai Vu
On Feb 28, 12:05 am, Stefan Behnel wrote: > Hal Styli, 27.02.2010 21:50: > > > I have a sed solution to the problems below but would like to rewrite > > in python... > > Note that sed (or any other line based or text based tool) is not a > sensible way to handle XML. If you want to read XML, use a

Re: Docstrings considered too complicated

2010-02-28 Thread Mel
Gregory Ewing wrote: > Mel wrote: > >> You could think of it as a not bad use of the design principle "Clear The >> Simple Stuff Out Of The Way First". Destinations are commonly a lot >> simpler than sources Calculations for immediate values could be just about anything. Mel. -- htt

Re: Method / Functions - What are the differences?

2010-02-28 Thread Michael Rudolf
Am 28.02.2010 15:08, schrieb Alf P. Steinbach: >>> "Hello".upper >>> f = "Hello".upper >>> f >>> f() 'HELLO' >>> >>> >>> >>> f.__self__ 'Hello' Holy hand grenade. You have no Idea how enlightened I feel right now :D Thank you, "bound method" was the term I forgot and your examp

Re: Printing the arguments of an attribute in a class

2010-02-28 Thread Arnaud Delobelle
vsoler writes: > I have a class that is a wrapper: > > class wrapper: > def __init__(self, object): > self.wrapped = object > def __getattr__(self, attrname): > print 'Trace: ', attrname > #print arguments to attrname, how? > return getattr(self.wrapped, at

Re: Challenge: escape from the pysandbox

2010-02-28 Thread Aahz
In article , Daniel Fetchinson wrote: > >I guess they also have some kind of a sandbox if they let people run >python on their machines, I'm not sure if it's open source though. Thing is, I'm sure that Google uses a critical backstop to any Python-based sandbox: something like a chroot jail. Th

Py2exe - Bad File Descriptor

2010-02-28 Thread T
I have a Python script, which is a Windows Service, that I created an EXE of via py2exe. As part of the program, it calls some external binaries, one of which restarts the computer. When I'm logged in, this works fine. However, if I log out, the service stops and logs the following error in the

Re: Updates about Tk

2010-02-28 Thread Fabiano
rantingrick ha scritto: > On Feb 27, 11:11 am, Kevin Walzer wrote: > > (...snip...) > >> Kevin Walzer >> Code by Kevinhttp://www.codebykevin.com > > Great post Kevin! The only thing i would like to add are my two > favorite references for learning Tkinter. They are not geared around > the new t

Re: stripping fields from xml file into a csv

2010-02-28 Thread Stefan Behnel
Hai Vu, 28.02.2010 17:41: > By the way, Stefan, I am using Python 2.6. Do you know the differences > between ElementTree and cElementTree? Use cElementTree, it's implemented in C and a lot faster and more memory friendly. http://effbot.org/zone/celementtree.htm#benchmarks http://codespeak.net/lxm

Re: Upgrading Py2exe App

2010-02-28 Thread Aahz
In article , Ryan Kelly wrote: >On Wed, 2010-02-24 at 15:05 -0800, Aahz wrote: >> In article , >> Ryan Kelly wrote: >>> >>>Yes. The idea of having a "bootstrapping exe" is that actual >>>application code can be swapped out without having to overwrite the >>>executable file. As long as you don

[ANNC] pynguin-0.1 (python-based turtle graphics application)

2010-02-28 Thread Lee Harr
pynguin is a python-based turtle graphics application.     It combines an editor, interactive interpreter, and     graphics display area. It is meant to be an easy environment for introducing     some programming concepts to beginning programmers. http://pynguin.googlecode.com/ This is the in

PyQt4.7 and PyQwt5.2.0

2010-02-28 Thread Gib Bogle
I installed the latest PyQt (4.7-1), then PyQwt 5.2.0, which was built with PyQt4.5.4. This line import PyQt4.Qwt5 as Qwt fails to load the DLL. Could this be the result of not using PyQt4 4.5.4? -- http://mail.python.org/mailman/listinfo/python-list

Re: Py2exe - Bad File Descriptor

2010-02-28 Thread T
On Feb 28, 3:48 pm, Dennis Lee Bieber wrote: > On Sun, 28 Feb 2010 10:35:23 -0800 (PST), T > declaimed the following in gmane.comp.python.general: > > > I have a Python script, which is a Windows Service, that I created an > > EXE of via py2exe.  As part of the program, it calls some external > >

Earn Money Online without Investment

2010-02-28 Thread ranga...............
Earn Money Online without Investment Now anyone can earn money online with out any investment by using some genuine websites. The detailed information of some of the genuine everseen good earnings website information are presented clealy for free at http://earnmoneyonline-without-investment.blogs

Re: Docstrings considered too complicated

2010-02-28 Thread Aahz
In article <4b889e3d$0$27844$c3e8...@news.astraweb.com>, Steven D'Aprano wrote: >On Fri, 26 Feb 2010 21:51:17 -0600, Tim Daneliuk wrote: >> >> The only possible exception to this I can think of is when there is some >> non-obvious side-effect (i.e. language and/or hardware is >> "misfeatured"): >

Re: help with Python installation

2010-02-28 Thread gujax
On Feb 27, 10:14 pm, Arnaud Delobelle wrote: > On 28 Feb, 01:48, gujax wrote: > > > Hi, > > I have been trying to install python on my Win ME system for over two > > years - gave up for a while and now I am back with a resolve to solve > > the problem. I tried all versions of python but having in

Re: Challenge: escape from the pysandbox

2010-02-28 Thread Daniel Fetchinson
>>I guess they also have some kind of a sandbox if they let people run >>python on their machines, I'm not sure if it's open source though. > > Thing is, I'm sure that Google uses a critical backstop to any > Python-based sandbox: something like a chroot jail. The Python sandbox > is mostly there

Re: Quoting quotes

2010-02-28 Thread candide
OK, now I see the point. I was mistaken because I was supposing that every quote strictly _inside_ the string have to match another quote od the same type. Thanks to all for yours responses. -- http://mail.python.org/mailman/listinfo/python-list

Re: Use eval() safely?

2010-02-28 Thread W. Martin Borgert
Gregory Ewing wrote: > I posted a demonstration of this earlier in this thread. As you wrote, your example does not work when using eval() like in my original post with second and third parameter to eval(): >>> import math >>> eval("[c for c in (0).__class__.__bases__[0].__subclasses__() if c.__n

Re: cpan for python?

2010-02-28 Thread Steven D'Aprano
On Sun, 28 Feb 2010 17:27:22 +0100, Daniel Fetchinson wrote: > > Is it only me or others also mentally read C-SPAN when somebody writes > CPAN? No, it's not just you. This is the first time I've realised it wasn't C-SPAN. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Python dos2unix one liner

2010-02-28 Thread Steven D'Aprano
On Sun, 28 Feb 2010 12:05:12 +0100, Stefan Behnel wrote: > Steven D'Aprano, 28.02.2010 09:48: >> There ought to be some kind of competition for the least efficient >> solution to programming problems > > That wouldn't be very interesting. You could just write a code generator > that spits out ton

Re: stripping fields from xml file into a csv

2010-02-28 Thread Hal Styli
On 28 Feb, 19:20, Stefan Behnel wrote: > Hai Vu, 28.02.2010 17:41: > > > By the way, Stefan, I am using Python 2.6. Do you know the differences > > between ElementTree and cElementTree? > > Use cElementTree, it's implemented in C and a lot faster and more memory > friendly. > > http://effbot.org/z

Starting Python from the terminal with no welcome message

2010-02-28 Thread candide
Hi, Does exist some option I could send to the python interpreter during an interactive session in order to avoid the printing of the introductory message just above the top prompt ? In my case, the welcome message is the following : Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52) [GCC 4.2.3 (

Multiple console windows for a single program?

2010-02-28 Thread Blake B
Hello, I'm wanting to write a program with multiple objects, each in a thread. Both will be doing output (with the print statement) almost constantly, so I'd like to be able to separate their outputs. What I want to do is have a separate window for each. Is my only option to make my own "console"

Re: Starting Python from the terminal with no welcome message

2010-02-28 Thread alex goretoy
On Sun, Feb 28, 2010 at 5:23 PM, candide wrote: > Hi, > > Does exist some option I could send to the python interpreter during an > interactive session in order to avoid the printing of the introductory > message just above the top prompt ? > > In my case, the welcome message is the following :

Sample code usable Tkinter listbox

2010-02-28 Thread Alf P. Steinbach
In case Someone Else(TM) may need this. This code is just how it currently looks, what I needed for my code, so it's not a full-fledged or even tested class. But it works. import tkinter as t import tkinter.simpledialog import tkinter.messagebox t.askstring = tkinter.simpledialog.askstr

Re: Multiple console windows for a single program?

2010-02-28 Thread alex goretoy
On Sun, Feb 28, 2010 at 5:27 PM, Blake B wrote: > Hello, > > I'm wanting to write a program with multiple objects, each in a thread. > Both will be doing output (with the print statement) almost constantly, so > I'd like to be able to separate their outputs. What I want to do is have a > separate

Re: Starting Python from the terminal with no welcome message

2010-02-28 Thread Tim Chase
candide wrote: Does exist some option I could send to the python interpreter during an interactive session in order to avoid the printing of the introductory message just above the top prompt ? In my case, the welcome message is the following : Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52)

Draft PEP on RSON configuration file format

2010-02-28 Thread Patrick Maupin
All: Finding .ini configuration files too limiting, JSON and XML to hard to manually edit, and YAML too complex to parse quickly, I have started work on a new configuration file parser. I call the new format RSON (for "Readable Serial Object Notation"), and it is designed to be a superset of JSON

Re: Draft PEP on RSON configuration file format

2010-02-28 Thread Paul Rubin
Patrick Maupin writes: > I have started work on a new configuration file parser > The documentation is in rst PEP form, at:... N not another... there are too many already. :-( -1 -- http://mail.python.org/mailman/listinfo/python-list

Re: Sample code usable Tkinter listbox

2010-02-28 Thread rantingrick
On Feb 28, 6:30 pm, "Alf P. Steinbach" wrote: > In case Someone Else(TM) may need this. > > This code is just how it currently looks, what I needed for my code, so it's > not > a full-fledged or even tested class. Thanks for sharing Alf, Thats works fine "as-is" but what about inheriting from "t

Re: Draft PEP on RSON configuration file format

2010-02-28 Thread Steven D'Aprano
On Sun, 28 Feb 2010 20:09:30 -0600, Patrick Maupin wrote: > All: > > Finding .ini configuration files too limiting, JSON and XML to hard to > manually edit, and YAML too complex to parse quickly, I have started > work on a new configuration file parser. > > I call the new format RSON (for "Reada

Re: Sample code usable Tkinter listbox

2010-02-28 Thread Alf P. Steinbach
* rantingrick: On Feb 28, 6:30 pm, "Alf P. Steinbach" wrote: In case Someone Else(TM) may need this. This code is just how it currently looks, what I needed for my code, so it's not a full-fledged or even tested class. Thanks for sharing Alf, Thats works fine "as-is" but what about inheritin

Re: Draft PEP on RSON configuration file format

2010-02-28 Thread John Nagle
Patrick Maupin wrote: All: Finding .ini configuration files too limiting, JSON and XML to hard to manually edit, and YAML too complex to parse quickly, I have started work on a new configuration file parser. You're not supposed to edit those formats manually.

Re: Draft PEP on RSON configuration file format

2010-02-28 Thread Chris Rebert
On Sun, Feb 28, 2010 at 10:39 PM, John Nagle wrote: > Patrick Maupin wrote: >> >> All: >> >> Finding .ini configuration files too limiting, JSON and XML to hard to >> manually edit, and YAML too complex to parse quickly, I have started >> work on a new configuration file parser. > >   You're not s

Re: Sample code usable Tkinter listbox

2010-02-28 Thread rantingrick
On Feb 28, 9:57 pm, "Alf P. Steinbach" wrote: > * rantingrick: I just hate overriding all the paths to each listbox method. How about just overideing the Listboxe's geomerty methods once an your done? #-- start script --# import Tkinter as tk from Tkconstants import * import tkMessageBox as MB

Re: stripping fields from xml file into a csv

2010-02-28 Thread Stefan Behnel
Hal Styli, 01.03.2010 00:15: > Stefan, I was happy to see such concise code. > Your python worked with only very minor modifications. > > Hai's test xml data *without* the first and last line is close enough > to the data I am using: > > > > > > > > ... quirky. > > I get a large file given