Re: [Tutor] Name for this type of class?

2019-08-03 Thread Malcolm Greene
Thanks for everyone's feedback. Some interesting thoughts including Alan's "classes should never be named for their data but for their function" feedback. I'm going to have to noodle on that one. Good stuff! Malcolm ___ Tutor maillist - Tutor@python.

[Tutor] Name for this type of class?

2019-08-02 Thread Malcolm Greene
They same naming is one of the two biggest challenges when it comes to software. Or one of three if you count the "off-by-one" joke :) Anyways, I'm looking for help coming up for the proper name for a class that collects the following type of telemetry data that we use for operational analysis.

[Tutor] Remove specific chars from a string

2008-04-14 Thread Malcolm Greene
What is the Pythonic way to remove specific chars from a string? The .translate( table[, deletechars]) method seems the most 'politically correct' and also the most complicated. My ideas: 1. For each char to be removed, do a .replace( char_to_delete, '' ) 2. Do a .split( str_of_chars_to_delete )

[Tutor] Pythonic way to extract delimited substrings

2008-04-14 Thread Malcolm Greene
Suggestions on the best way to extract delimited substrings strings from a larger string? Background: I have a long multi-line string with expressions delimited with '<(' and ')>' markers. I would like to extract these substrings and process them in a loop. Because the left and right delimiters a

[Tutor] How to normalize/compress whitespace in a string?

2008-04-11 Thread Malcolm Greene
Any suggestions for how to normalize and compress whitespace in a string? By normalize I mean convert tabs and soft spaces (extended ascii code 160) to spaces. By compress I mean replace all runs of 2 or more spaces (after the normalization step) to a single space. I know I can use regular expre