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.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[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. We use various combinations of these attributes depending on context. 

event_type
event_step
file_count
line_count
byte_count
row_count
batch_count
job_count
error_count
warning_count
duration

Here are the ways we've come up with to describe a class that collects this 
info:

JobMetrics
JobStats or JobStatistics
JobTelemetry

None of these feel right and of course everyone on our team has a different 
opinion.

Does this question ring any bells?

Thank you,
Malcolm
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[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 ) followed by a ''.join()

3. Use a regular expression

4. Other?

Thanks!
Malcolm
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[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 are different from each other
*and* multi-char strings, it would appear that the .split() method would
not be an appropriate tool for this work.

I know how to do this task with regular expressions, but I'm always
cautious about using a bazooka when a hammer will suffice.

What strategy would you recommend?

1. Write a simple parsing function using string primitives (find,
slicing)

2. Use regular expressions

3. Use a 3rd party string processing module

Thanks!
Malcolm

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[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 expressions to accomplish the above, but
thought that might be too heavy handed.

Thank you!

Malcolm
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor