Re: [Tutor] Ide To use? Other extras to install?

2010-10-11 Thread Alan Gauld
"Jorge Biquez" wrote I am in the process of leaving Windows as my environment and moving to Ubuntu or a Mac. For a few months I will have to continue working under windows until I finish my moving process. Anyway, I would like to start using and IDE that I can install at least in Windows and

Re: [Tutor] OpenMP

2010-10-11 Thread Stefan Behnel
Alan Gauld, 09.10.2010 19:50: Now, the bad news is that so far as I know the python interpreter does not expose its threading model to the OS to even if you use threads the interpreter itself will still be running on a single CPU core. :-( Python's threads are native system threads. They can ru

Re: [Tutor] Hiding Superclass Methods

2010-10-11 Thread Alan Gauld
"Denis Gomes" wrote I have a basic python question. I am writing an n dimensional vector class by inheriting from the builtin python list object. I want to be able to hide the parent object's methods in the derived class instances. Doing so would break the Liskofff Substitution Princip

Re: [Tutor] Rounding a Python float to the nearest half integer

2010-10-11 Thread Sithembewena Lloyd Dube
Thanks everyone. On Fri, Oct 8, 2010 at 11:44 PM, Wayne Werner wrote: > On Fri, Oct 8, 2010 at 7:58 AM, Sithembewena Lloyd Dube > wrote: > >> I realise that one cannot have a half integer :) I meant how would one >> round off to the first decimal nearest to either 0.5, or a whole number. >> >> U

Re: [Tutor] Rounding a Python float to the nearest half integer

2010-10-11 Thread Shantanoo
=== round(...) round(number[, ndigits]) -> floating point number Round a number to a given precision in decimal digits (default 0 digits). This always returns a floating point number. Precision may be negative. === >>> round(1.23423,2) 1.23 >>> round(1.23623,2) 1.24 HTH. On Mon, O

Re: [Tutor] Rounding a Python float to the nearest half integer

2010-10-11 Thread Sithembewena Lloyd Dube
Thanks Shantanoo, finally got the hang of this. 2010/10/11 शंतनू (Shantanoo) > === > round(...) > round(number[, ndigits]) -> floating point number > > Round a number to a given precision in decimal digits (default 0 > digits). > This always returns a floating point number. Precisio

Re: [Tutor] list of dict question

2010-10-11 Thread Francesco Loffredo
Thank you, Alan and Dave, for your spotting this weak point in my understanding of Python! On 11/10/2010 2.11, Dave Angel wrote: On 2:59 PM, Alan Gauld wrote: "Francesco Loffredo" wrote did, Roelof's code would work perfectly, and you could store in a list all the subsequent changes of a d

Re: [Tutor] Using contents of a document to change file names, (was Re: how to extract data only after a certain ...)

2010-10-11 Thread Josep M. Fontana
Sorry about the confusion with the subject line. I was receiving messages in digest mode and I copied and pasted the wrong heading in my previous message. Now I have written the heading corresponding to my initial message. I have also changed the settings for this list from the digest mode to the

Re: [Tutor] Basics

2010-10-11 Thread Francesco Loffredo
On 28/09/2010 12.05, Alan Gauld wrote: If you are already fairly experienced you might find the Python Challenge web site a fun way to learn too. www.pythonchallenge.com I didn't know of this site, it's VERY interesting and funny! Thank you, Alan. Francesco Nessun virus nel messaggio in uscit

Re: [Tutor] Using contents of a document to change file names, (was Re: how to extract data only after a certain ...)

2010-10-11 Thread Christian Witts
On 11/10/2010 13:46, Josep M. Fontana wrote: I tried your suggestion of using .split() to get around the problem but I still cannot move forward. I don't know if my implementation of your suggestion is the correct one but here's the problem I'm having. When I do the following: ---

Re: [Tutor] WRITING XLS FROM OS.WALK()

2010-10-11 Thread Susana Iraiis Delgado Rodriguez
Hello members! Thank you all of you for taking the time to answer to my question. I didn´t expect it will create the controversy we just had in this topic. I don't mind for the comments of re-inventing the wheel, I'm new in python, documentation is good but programmers' experience is even better.

Re: [Tutor] WRITING XLS FROM OS.WALK()

2010-10-11 Thread Joel Goldstick
On Mon, Oct 11, 2010 at 9:37 AM, Susana Iraiis Delgado Rodriguez < susana.delgad...@utzmg.edu.mx> wrote: > Hello members! > > Thank you all of you for taking the time to answer to my question. I didn´t > expect it will create the controversy we just had in this topic. I don't > mind for the commen

Re: [Tutor] Hiding Superclass Methods

2010-10-11 Thread Denis Gomes
Thank you both for your responses. I do have one other question if I use the method both of you describe. How do I go about implementing slicing and indexing for an object in python? A list object innately has them and that is really why I wanted to use it. I would appreciate it if you can point

Re: [Tutor] Hiding Superclass Methods

2010-10-11 Thread Adam Bark
On 11/10/10 15:29, Denis Gomes wrote: Thank you both for your responses. I do have one other question if I use the method both of you describe. How do I go about implementing slicing and indexing for an object in python? A list object innately has them and that is really why I wanted to use i

Re: [Tutor] Ide To use? Other extras to install?

2010-10-11 Thread Dave Kuhlman
On Mon, Oct 11, 2010 at 09:06:14AM +0100, Alan Gauld wrote: > > "Jorge Biquez" wrote > > >I am in the process of leaving Windows as my environment and moving > >to Ubuntu or a Mac. For a few months I will have to continue working > >under windows until I finish my moving process. Anyway, I wo

Re: [Tutor] Hiding Superclass Methods

2010-10-11 Thread Dave Kuhlman
On Mon, Oct 11, 2010 at 08:25:24AM +0200, Knacktus wrote: > > Am 11.10.2010 06:24, schrieb Denis Gomes: > >Hi Everyone, > > > >I have a basic python question. I am writing an n dimensional vector > >class by inheriting from the builtin python list object. I want to be > >able to hide the par

Re: [Tutor] Hiding Superclass Methods

2010-10-11 Thread Walter Prins
On 11 October 2010 15:55, Adam Bark wrote: > You can use __getslice__, __setslice__ etc. methods. They're detailed in > the list docstrings. Here's an example of using __getslice__ > > >>> dir([]) > ['__add__', '__class__', '__contains__', '__delattr__', '__delitem__', > '__delslice__', '__doc__'

Re: [Tutor] WRITING XLS FROM OS.WALK()

2010-10-11 Thread Walter Prins
On 11 October 2010 14:37, Susana Iraiis Delgado Rodriguez < susana.delgad...@utzmg.edu.mx> wrote: > The other question is about the excel files management, if I want to > manipulate this data to work it in Excel should I look for an excel library > in python right? > > Yes. I already mentioned one

Re: [Tutor] Hiding Superclass Methods

2010-10-11 Thread Denis Gomes
I understand where to go from here. Thanks to all who responded. Appreciate it. Denis ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Ide To use? Other extras to install?

2010-10-11 Thread Jed Smith
On Sun, Oct 10, 2010 at 9:31 PM, Jorge Biquez wrote: > What would be the IDE you recommend me to install that would be almost > transparent to be using in both platforms? For transparency on multiple platforms, I need to reiterate the suggestion to use the "traditional" IDE - editor, interactive

[Tutor] Help installing HLS Player

2010-10-11 Thread p4ddy
Hi, I have a HLS Player written in python but whenever I try to install it, I get this error "ImportError: No module named setuptools" So I downloaded setuptools-0.6c11.zip and tried to install it, again i got this error "ImportError: No module named distutils.util" So I went back and downloa

Re: [Tutor] Help installing HLS Player

2010-10-11 Thread Wayne Werner
On Mon, Oct 11, 2010 at 6:56 AM, p4ddy wrote: > > Hi, > > I have a HLS Player written in python but whenever I try to install it, I > get this error > > "ImportError: No module named setuptools" > > So I downloaded setuptools-0.6c11.zip and tried to install it, again i got > this error > > "Impor

[Tutor] If/else in Python 2.6.5 vs. Python 2.4.3

2010-10-11 Thread aeneas24
Hi, I have code that works fine when I run it on Python 2.6.5, but I get an "invalid syntax" error in Python 2.4.3. I'm hoping you can help me fix it. The line in question splits a chunk of semi-colon separated words into separate elements. rgenre = re.split(r';', rf.info["genre"] if "genre"

Re: [Tutor] WRITING XLS FROM OS.WALK()

2010-10-11 Thread Susana Iraiis Delgado Rodriguez
Hello Walter and members: I'm working with csv to handle excel, my other was useful to do my new cvs file. When I open the output file, it has all the information I need, but all of my lines have the filepath separate by comes, even though it's supposed to be a complete string; for example: C,:,\,

Re: [Tutor] Using contents of a document to change file names, (was Re: how to extract data only after a certain ...)

2010-10-11 Thread Alan Gauld
"Josep M. Fontana" wrote I tried your suggestion of using .split() to get around the problem but I still cannot move forward. fileNameCentury = open(r '/Volumes/DATA/Documents/workspace/GCA/CORPUS_TEXT_LATIN_1/FileNamesYears.txt' .split('\r')) You are trying to split the filename not th

Re: [Tutor] list of dict question

2010-10-11 Thread Alan Gauld
"Francesco Loffredo" wrote lst = [] for n in range(3): obj = {} I didn't know that this creates a new obj if obj already exists, I thought it would just update it. That's my mistake. Yes you have to remember that in Python, unlike C etc, names are not aliases for memory locations. They are

Re: [Tutor] If/else in Python 2.6.5 vs. Python 2.4.3

2010-10-11 Thread Wayne Werner
On Mon, Oct 11, 2010 at 12:10 PM, wrote: > > > rgenre = re.split(r';', rf.info["genre"] if "genre" in rf.info else [] > > I get a syntax error at "if" in 2.4.3. > That's because you're using the ternary operator that was not available in 2.4: http://www.python.org/dev/peps/pep-0308/ > > I tr

[Tutor] Attempt to overwrite excel cell Python

2010-10-11 Thread Susana Iraiis Delgado Rodriguez
Hello members: I'm using xlwt from python to work with excel, I'm developing some sort of system crawler to look for all the files ending with .shp, I took a look to csv, but I didn't understand it. Now, I have to create a .xls where people can save information from shp files, but first I have to

Re: [Tutor] dictionary and more

2010-10-11 Thread Jack Uretsky
Hi- I apologize for the size of the attached file, but the question would make little sense if I made substantial deletions. The program gives the following error: Traceback (most recent call last): File "/Javastuff/python/Glau_Is.py", line 131, in Adestin[state]() TypeError: 'No

Re: [Tutor] dictionary and more

2010-10-11 Thread Alan Gauld
"Jack Uretsky" wrote Please do not reply to an existing thread when starting a new topic. This messes up threaded newsreaders and several archives. Start a new topic with a newmessage. I apologize for the size of the attached file, but the question would make little sense if I made subst

Re: [Tutor] dictionary and more

2010-10-11 Thread Emile van Sebille
On 10/11/2010 9:19 AM Jack Uretsky said... Hi- I apologize for the size of the attached file, but the question would make little sense if I made substantial deletions. The program gives the following error: Traceback (most recent call last): File "/Javastuff/python/Glau_Is.py", line 131, in Ades

Re: [Tutor] If/else in Python 2.6.5 vs. Python 2.4.3

2010-10-11 Thread Dave Angel
On 2:59 PM, aenea...@priest.com wrote: Hi, I have code that works fine when I run it on Python 2.6.5, but I get an "invalid syntax" error in Python 2.4.3. I'm hoping you can help me fix it. The line in question splits a chunk of semi-colon separated words into separate elements. rgenre = re

Re: [Tutor] Attempt to overwrite excel cell Python

2010-10-11 Thread Steven D'Aprano
On Tue, 12 Oct 2010 07:08:15 am Susana Iraiis Delgado Rodriguez wrote: > But when I run it, it throws me the error: > *Exception*: *Attempt to overwrite cell*: sheetname='shp' rowx=1 > colx=0, don't know what is wrong Please don't summarise the error. Copy and paste the exact error message, incl

Re: [Tutor] dictionary and more

2010-10-11 Thread Steven D'Aprano
On Tue, 12 Oct 2010 03:19:22 am Jack Uretsky wrote: > Hi- > I apologize for the size of the attached file, but the question > would make little sense if I made substantial deletions. > The program gives the following error: > Traceback (most recent call last): >File "/Javastuff/pyth

Re: [Tutor] Hiding Superclass Methods

2010-10-11 Thread Steven D'Aprano
On Tue, 12 Oct 2010 01:55:10 am Adam Bark wrote: > On 11/10/10 15:29, Denis Gomes wrote: > > Thank you both for your responses. I do have one other question if > > I use the method both of you describe. How do I go about > > implementing slicing and indexing for an object in python? A list > > ob

[Tutor] Multiple regex replacements, lists and for.

2010-10-11 Thread Will Geary
Hello all, I'm new to python and inexperienced in programming but I'm trying hard. I have a shell script that I'm converting over to python. Part of the script replaces some lines of text. I can do this in python, and get the output I want, but so far only using sed. Here's an example script: imp

Re: [Tutor] Networking

2010-10-11 Thread Chris King
On 10/3/2010 7:20 PM, Chris King wrote: On 10/2/2010 3:40 PM, Evert Rol wrote: Dear Tutors, I have attached my 2 programs for networking. It uses socket and SocketServer, but it just simplifies it even more. The problem is it won't work. The Client raises the error, (with trace back) T

Re: [Tutor] Hiding Superclass Methods

2010-10-11 Thread Adam Bark
On 11/10/10 23:52, Steven D'Aprano wrote: On Tue, 12 Oct 2010 01:55:10 am Adam Bark wrote: On 11/10/10 15:29, Denis Gomes wrote: Thank you both for your responses. I do have one other question if I use the method both of you describe. How do I go about implementing slicing and indexi

Re: [Tutor] Attempt to overwrite excel cell Python

2010-10-11 Thread Walter Prins
Hi Susana, On 11 October 2010 21:08, Susana Iraiis Delgado Rodriguez < susana.delgad...@utzmg.edu.mx> wrote: > > *Exception*: *Attempt to overwrite cell*: sheetname='shp' rowx=1 colx=0, > don't know what is wrong > > This is a default of xlwt behaviour for writing Excel files. It assumes it woul