Implement C's Switch in Python 3

DL Neil PythonList at DancesWithMice.info
Sun Feb 3 15:35:41 EST 2019


On 3/02/19 10:16 PM, Chris Angelico wrote:
> On Sun, Feb 3, 2019 at 8:09 PM DL Neil <PythonList at danceswithmice.info> wrote:
>> On 3/02/19 9:45 PM, Chris Angelico wrote:
>>> Which is why I always write dates in sorted format, usually eschewing
>>> delimiters:
>>> //CJA 20160511: Is this still happening? I don't remember seeing it in
>>> three parts of forever.
>> Sure is. It is an acceptable alternative under the ISO standard.
> 
> Not sure if you're responding to the content of the comment there;

Comment? I don't see no #, ''', or """!
(am teasing)


[ccyymmdd cf ccyy-mm-dd]
>> Some would say it is more sensible to use when storing data because it
>> removes the dash/hyphen separators in exchange for implying the
>> fixed-format. (more bytes/characters saved if extend to include the time)
>>
>> I'm not going there - recalling folk from these memory-is-cheap times
>> being less able to understand why we used to save 'expensive' storage
>> space by using yy-years (instead of ccyy) and thus 'causing' "the
>> millennium bug" aka Y2K!
> 
> Skipping the delimiter isn't about saving space, it's about
> consistency. If I say "non-delimited sorted date", you can almost
> certainly write out a character-for-character identical date - handy
> if you want to search a bunch of files, for instance. Having
> delimiters leaves people free to dispute whether they should be
> slashes, hyphens, dots, or maybe something else.

This logic indisputable.

However, the whole purpose of an ISO standard is to remove "dispute", 
locally and internationally! Thus, if not sufficiently-well stated 
earlier, the standard is actually for information interchange purposes.


 >> I find it much slower to decode than reading the same with embedded
 >> separators!
 > Sure. I mainly use it in contexts where the most important information
 > is simply "that's a date", rather than actually caring what the date
 > *is*.
[paras re-ordered]

+1


In case other readers are following-along-at-home, and the (above) 
purpose of the standard was insufficiently obvious, I did a bit of 
review 'homework':

- ISO standards are still not $free

- a good write-up from the ISO appears on the Wayback machine at 
https://web.archive.org/web/20110614235056/http://www.iso.org/iso/support/faqs/faqs_widely_used_standards/widely_used_standards_other/date_and_time_format.htm
- the above makes the point about "interchange" and offers similar 
examples of date-confusion to those 'here'/earlier
- mention is made of formats including/excluding delimiters
(I haven't been able to check this, but can't find any evidence that 
separators other than "-" are allowed (in dates) )

- in lieu of the ISO text, those of us working over the Internet will 
turn to RFC 3339
- this is a slight simplification of the ISO standard
- the ABNF appendix *requires* a dash/hyphen as (date) separator

- Markus Kuhn at Cambridge (British university) provides a readable and 
thought-provoking summary at https://www.cl.cam.ac.uk/~mgk25/iso-time.html
- uses dashes/hyphens
- discusses international considerations (I've just learned that the 
Chinese date notation preceded the ISO order, as did the conventions of 
a number of other countries)
- supports the compact/'no debate' format "The hyphens can be omitted if 
compactness of the representation is more important than human 
readability" (as well as caring for my fading vision)


>> I wouldn't use it in a 'visible' situation though, eg a fileNM. Yes, it
>> is shorter, but as my eyes age (they are already older than my teeth!),
> Guess your teeth better work on catching up...

Can't put them under the pressure of thinking it is a race - they could 
decide to drop out!


>>> That said, I am aware that I am not in any way a "normal person".
>>> Using month names as per your other example is probably a fair
>>> compromise with other humans.

In this life, one does have to make allowances...


>> There's normal and there's normal - like it's tomato or tomato?
> I dunno. I'm the kind of normal that likes tomatoes (not to be
> confused with tomatoes). Does that help?

If you like tomatoes, and tomatoes are fruit, do you (normally) chug 
tomato sauce (ketchup) as if it is fruit juice?

-- 
Regards =dn


More information about the Python-list mailing list