Sayth Renshaw at 2019/2/3 UTC+8 AM9:52:50 wrote:
> Or perhaps use a 3rd party library like
> https://github.com/mikeckennedy/python-switch
Thank you for this link. It's a good general implementation.
--Jach
--
https://mail.python.org/mailman/listinfo/python-list
Am 05.02.19 um 02:20 schrieb DL Neil:
So, even with the French making their dates into sentences, not a single
one uses ordinals!
- did the computer people in all these languages/cultures decide that
the more numeric approach was better/easier/...
(ie simpler/less-complex)
:)
For the two lan
On 2019-02-06 00:25, John Sanders wrote:
On Saturday, February 2, 2019 at 6:47:49 PM UTC-6, Sayth Renshaw wrote:
Hi
I am trying to convert a switch statement from C into Python. (why? practising).
This is the C code.
printf("Dated this %d", day);
switch (day) {
case 1: case 21: case 3
On Saturday, February 2, 2019 at 6:47:49 PM UTC-6, Sayth Renshaw wrote:
> Hi
>
> I am trying to convert a switch statement from C into Python. (why?
> practising).
>
> This is the C code.
>
> printf("Dated this %d", day);
> switch (day) {
> case 1: case 21: case 31:
> printf("st"
On 4/02/19 9:25 PM, Christian Gollwitzer wrote:
Am 04.02.19 um 09:18 schrieb Christian Gollwitzer:
I think English is quite "unique" with writing out the ending of the
ordinals attached to arabic numerals.
Of course, there is a Wikipedia page about it:
https://en.wikipedia.org/wiki/Ord
Am 04.02.19 um 09:18 schrieb Christian Gollwitzer:
I think English is quite "unique" with writing out the ending of the
ordinals attached to arabic numerals.
Of course, there is a Wikipedia page about it:
https://en.wikipedia.org/wiki/Ordinal_indicator
So I was wrong and the abbrevi
Am 04.02.19 um 04:11 schrieb DL Neil: > On 4/02/19 10:00 AM, Christian
Gollwitzer wrote:
Am 03.02.19 um 09:32 schrieb DL Neil:
Now back to ordinal dates - the "st", "th", etc suffixes only work in
English. You'd need another list (but no great coding complexity) to
cope with a second, third, ..
Christian,
On 4/02/19 10:00 AM, Christian Gollwitzer wrote:
Am 03.02.19 um 09:32 schrieb DL Neil:
Now back to ordinal dates - the "st", "th", etc suffixes only work in
English. You'd need another list (but no great coding complexity) to
cope with a second, third, ... language!
Only for some
On Mon, Feb 4, 2019 at 10:53 AM Avi Gross wrote:
> It is very bad form to have ambiguous compressed formats. Even if you include
> a slash or minus sign or period or the delimiter of your choice, I sometimes
> see this:
>
> 01/02/2020
>
> And I wonder if it is meant to be January 2nd or February
On Mon, Feb 4, 2019 at 11:08 AM Chris Angelico wrote:
> If you need to attach some *other* time zone (which should be rare -
> ONLY do this if you absolutely cannot translate to UTC)
BTW, there are some legit reasons for keeping something in a different
timezone. If you're representing an instant
Comment at end:
-Original Message-
From: Python-list On
Behalf Of Bob van der Poel
Sent: Sunday, February 3, 2019 4:01 PM
To: DL Neil
Cc: Python
Subject: Re: Implement C's Switch in Python 3
I'm surprised that no one has yet addressed the year 1 problem.
Hopefully w
On Sun, Feb 3, 2019 at 2:15 PM Chris Angelico wrote:
> On Mon, Feb 4, 2019 at 8:02 AM Bob van der Poel wrote:
> >
> > I'm surprised that no one has yet addressed the year 1 problem.
> Hopefully we're doing numeric, not alpha sorts on the stuff before the 1st
> '-'. And, the compact versions
On Mon, Feb 4, 2019 at 8:02 AM Bob van der Poel wrote:
>
> I'm surprised that no one has yet addressed the year 1 problem. Hopefully
> we're doing numeric, not alpha sorts on the stuff before the 1st '-'. And,
> the compact versions will really screw up :).
>
Compact versions? You mean non-
Am 03.02.19 um 09:32 schrieb DL Neil:
Now back to ordinal dates - the "st", "th", etc suffixes only work in
English. You'd need another list (but no great coding complexity) to
cope with a second, third, ... language!
Only for some languages. In other languages there can be, for example,
case
On Mon, Feb 4, 2019 at 7:35 AM DL Neil wrote:
>
> On 3/02/19 10:16 PM, Chris Angelico wrote:
> >> 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
On Sun, Feb 3, 2019 at 1:35 PM DL Neil
wrote:
> On 3/02/19 10:16 PM, Chris Angelico wrote:
> > On Sun, Feb 3, 2019 at 8:09 PM DL Neil
> 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
On 3/02/19 10:16 PM, Chris Angelico wrote:
On Sun, Feb 3, 2019 at 8:09 PM DL Neil 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 part
The discussion strictly sets a limit of 31 for the largest number of days in
a month and asks for suffixes used to make ordinal numbers like 31st.
But in reality, you can go to 99th and beyond for other purposes albeit the
pattern for making 101 and on seems to repeat.
The last algorithm I wrote
"Sayth Renshaw" wrote in message
news:73a1c64c-7fb1-4fc8-98a2-b6939e82a...@googlegroups.com...
chooseFrom = { day : nthSuffix(day) for day in range(1,32)}
chooseFrom
{1: '1st', 2: '2nd', 3: '3rd', 4: '4th', 5: '5th', 6: '6th', 7: '7th', 8:
'8th', 9: '9th', 10: '10th', 11: '11th', 12: '12th',
On Sun, Feb 3, 2019 at 8:09 PM DL Neil 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
Chris,
On 3/02/19 9:45 PM, Chris Angelico wrote:
On Sun, Feb 3, 2019 at 7:40 PM DL Neil wrote:
This would normally see us coding "2019-02-03". The arrangement of
larger to ever more precise time-units is very useful in databases and
applications such as file-names, because it sequences logical
On Sun, Feb 3, 2019 at 7:40 PM DL Neil wrote:
> This would normally see us coding "2019-02-03". The arrangement of
> larger to ever more precise time-units is very useful in databases and
> applications such as file-names, because it sequences logically.
>
> However, that is not the way 'normal pe
When a client demanded his way on this issue, the action we took was, as
below, to create a list (called ordinal) and to use the dd (day) value
as an index.
[ nthSuffix(day) for day in range(1,32)]
['1st', '2nd', '3rd', '4th', '5th', '6th', '7th', '8th', '9th', '10th',
'11th', '12th', '13th'
Chris Angelico schrieb am 03.02.19 um 02:23:
> Of course, you can also precompute this:
>
> day_ordinal = mapper(
> [1, 21, 31], "st",
> [2, 22], "nd",
> [3, 23], "rd",
> )
> def f(x): return day_ordinal.get(x, "th")
… in which case I would also 'precompute' the ".get" and
fix(day) for day in range(1,32)}
> >>> chooseFrom
> {1: '1st', 2: '2nd', 3: '3rd', 4: '4th', 5: '5th', 6: '6th', 7: '7th', 8:
> '8th', 9: '9th', 10: '10th', 11: '11th', 12:
7;, 8:
'8th', 9: '9th', 10: '10th', 11: '11th', 12: '12th', 13: '13th', 14: '14th',
15: '15th', 16: '16th', 17: '17th', 18: '18th', 19: '19th', 20: '20th', 21:
'21st
t; 13rd
> 14th
> 15th
> 16th
> 17th
> 18th
> 19th
> 20th
> 21st
> 22nd
> 23rd
> 24th
> 25th
> 26th
> 27th
> 28th
> 29th
> 30th
> 31st
>
> -Original Message-
> From: Python-list On
> Behalf Of Sayth Renshaw
> Sent: Saturday
On 2019-02-03 02:51, Avi Gross wrote:
I may be missing something, but the focus seems to be only on the rightmost
digit. You can get that with
I had the same thought, but came across a problem. "11st", "12nd", "13rd"?
[snip]
Output:
for day in range(1, 32):
print( nthSuffix(day))
7th
18th
19th
20th
21st
22nd
23rd
24th
25th
26th
27th
28th
29th
30th
31st
-Original Message-
From: Python-list On
Behalf Of Sayth Renshaw
Sent: Saturday, February 2, 2019 8:53 PM
To: python-list@python.org
Subject: Re: Implement C's Switch in Python 3
> >I am trying to conver
Cameron wrote:
> Skip has commented on lists being unhashable. We can elaborate on that
> if you like.
>
> However, even if you went to tuples (which would let you construct the
> dict you lay out above), there is another problem.
>
> You're looking up "x" in the dict. But the keys of the dict are
> >I am trying to convert a switch statement from C into Python. (why?
> >practising).
> >
> >This is the C code.
> >
> >printf("Dated this %d", day);
> > switch (day) {
> >case 1: case 21: case 31:
> >printf("st"); break;
> >case 2: case 22:
> >printf("nd"); break;
> >
On 02Feb2019 16:47, Sayth Renshaw wrote:
I am trying to convert a switch statement from C into Python. (why?
practising).
This is the C code.
printf("Dated this %d", day);
switch (day) {
case 1: case 21: case 31:
printf("st"); break;
case 2: case 22:
printf("nd"); break;
On Sun, Feb 3, 2019 at 11:51 AM Sayth Renshaw wrote:
>
> Hi
>
> I am trying to convert a switch statement from C into Python. (why?
> practising).
>
> This is the C code.
>
> printf("Dated this %d", day);
> switch (day) {
> case 1: case 21: case 31:
> printf("st"); break;
> case
>
> I have an unhashable type list.
>
Try replacing the list with a tuple. Also, read up on immutable v mutable
types and dictionary keys for a bit of background on why a list won't work.
Skip
>
--
https://mail.python.org/mailman/listinfo/python-list
Hi
I am trying to convert a switch statement from C into Python. (why? practising).
This is the C code.
printf("Dated this %d", day);
switch (day) {
case 1: case 21: case 31:
printf("st"); break;
case 2: case 22:
printf("nd"); break;
case 3: case 23:
printf
35 matches
Mail list logo