Re: [Tutor] try except continue

2005-07-28 Thread tpc247
hi Danny, well from my previous message: ideally what I'd like is for my procedural program, when it runs through its steps and encounters an error, to log the error and pick up where it left off and keep going. so for the execution of someProcedure(), I want it to print the error and continue ru

Re: [Tutor] try except continue

2005-07-28 Thread tpc247
hi Alan and Danny, I think I understand what you guys are saying. I don't believe I am ignoring the error. Ideally what I'd like is for the procedural program to run through its steps and if it encounters an error, to log the error and pick up where it left off and keep going. I gather you thin

Re: [Tutor] try except continue

2005-08-01 Thread tpc247
hi guys, so I've been running through Alan's code, and for a while I suspected that the try block must be the first line of code after the loop in order to be executed. The reason I say this is I wanted to see for myself Alan's assertion that the continue skips to the next iteration, instead of co

[Tutor] don't repeat yourself; question about code optimization

2007-07-20 Thread tpc247
dear fellow Python enthusiasts: in the last year I have been experimenting with Python, and I set out to create a function that, given a number of items and a maximum number of items per row, would generate a table of rows of items. However, there is one part where I believe I violate the prime

Re: [Tutor] don't repeat yourself; question about code optimization

2007-07-22 Thread tpc247
On 7/20/07, Bob Gailer <[EMAIL PROTECTED]> wrote: Take advantage of slicing: def create_grid(self): table = [] for i in range(0, len(self.total_num_of_items), self.max_num_of_items_per_row): table.append(tuple(self.total_num_of_items[i : i + self.max_num_of_items_per_ro

Re: [Tutor] don't repeat yourself; question about code optimization CORRECTION

2007-07-29 Thread tpc247
On 7/23/07, Bob Gailer <[EMAIL PROTECTED]> wrote: > > A correction to the code at the end. The test of self.total_num_of_items > should precede the pop(0) Bob, I spent today studying what you've been telling me and I put the finishing touches to make your code pass my battery of tests. It still

Re: [Tutor] don't repeat yourself; question about code optimization

2007-07-29 Thread tpc247
On 7/23/07, Alan Gauld <[EMAIL PROTECTED]> wrote: > > The prime directive of coding is make it readable! > The DRY principle is just that a principle. If repeating makes for > more maintainable or readable code then repeat yourself. > > Remember 80% of the cost of software is in maintenance not in

[Tutor] passing form data into a class

2007-07-30 Thread tpc247
dear fellow Python enthusiasts, let's say I have a dictionary of keys and values obtained from a form submitted by a user. For each submitted form I will create the Application and Candidate classes, and I want to be able to call Application(Candidate(**submitted_data)).display() to create an html

[Tutor] unicode and character sets

2007-08-16 Thread tpc247
dear fellow Python enthusiasts, I recently wrote a script that grabs a file containing a list of ISO defined countries and creates an html select element. That's all well and good, and everything seems to work fine, except for one little nagging problem: http://en.wikipedia.org/wiki/Aland_Island

Re: [Tutor] unicode and character sets

2007-08-16 Thread tpc247
On 8/16/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > thanks, one of the good folks at metafiler provided the link to an > excellent introductory article > > correction: metafilter ___ Tutor maillist - Tutor@python.org http://mail.python.org/

Re: [Tutor] unicode and character sets

2007-08-16 Thread tpc247
On 8/16/07, Kent Johnson <[EMAIL PROTECTED]> wrote: > > [EMAIL PROTECTED] wrote: > > Good start! thanks, one of the good folks at metafiler provided the link to an excellent introductory article I don't think this is necessary. Did it actually fix anything? Changing > the default encoding is not

[Tutor] operating system key-bindings that call Python scripts

2007-08-20 Thread tpc247
I have a particular date time format I use for making entries in various logs I maintain, and ideally what I'd like is for my operating system (Windows or Linux) to recognize that every time I type, say, -'C' '1', a Python script I wrote will execute and out will pop the current date time in my des

[Tutor] adding a new folder to Python's importable modules search path

2007-11-25 Thread tpc247
Dear fellow Python enthusiasts, I trust your Thanksgiving holiday has been a relaxing one. A quick question for you: I have a script that attempts to import my_module from a folder that is not in Python's importable modules search path. In my script, that I run from the command line, I have the

Re: [Tutor] adding a new folder to Python's importable modules search path

2007-11-25 Thread tpc247
On 11/25/07, Kent Johnson <[EMAIL PROTECTED]> wrote: > > > > Should be sys.path.append(...) > > Kent yes, I'm sorry, in my posting I did have a typographical error, but my code has the following seemingly correct lines: sys.path.append(PATH_TO_MODULE) print "Path added:

Re: [Tutor] adding a new folder to Python's importable modules search path

2007-11-26 Thread tpc247
hey guys, thanks a lot for your insight (or lack thereof) which convinced me to try further investigation on what I might have left out. One significant point of correction: for purposes of simplification, I neglected to include for your review the fact that when I attempted to add my path to Pyth

Re: [Tutor] adding a new folder to Python's importable modules search path

2007-11-26 Thread tpc247
and for purposes of continuity TableParse should be replaced with My_Module ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] How do I make a variable that refers to an object have the same label as the object's name ?

2006-10-05 Thread tpc247
question for the Python crowd:when creating a series of objects, where each object represents a field from a submitted html form, how do I make variables that reference the objects be the same as the names of the respective objects ? For example, I have a class called Datum:class Datum:    def __in

[Tutor] when I create an instance of a class that inherits from Python dictionary, my data disappears

2006-10-06 Thread tpc247
hi all, I would like to create a class that specializes Python dictionary.  I would like an instance of this class to store objects representing html form data, and I would like to have an instance of this Data_Set class be able to use the Python dictionary method pop to remove objects as I see fit

[Tutor] my first object model, using an interface

2008-07-05 Thread tpc247
Dear fellow Python enthusiasts: I want to run an idea by you to see if I understand modeling objects adequately, after reading Alan Gauld's excellent tutorial and two brief articles about interfaces in Python, here: http://www.freenetpages.co.uk/hp/alan.gauld/tutclass.htm http:/