38 comments

[ 4.6 ms ] story [ 83.8 ms ] thread
(2003) (but that’s not what matter).
ITYM ⅯⅯⅢ
I Aprilis MMIII (mapping from Gregorian to Julian calendar left as an exercise to the reader)
> Programs that use variable names that are all upper case and contain only the characters M, D, C, L, X, V and I will be affected by the new literals.

MIDI, MIC, MIX... I guess musicians didn't like this proposal :)

MIDI shouldn't be affected.
Neither should MIC.
from the proposal:

> Any literal composed entirely of M, D, C, L, X, V and I characters that does not follow this format will raise a syntax error, because explicit is better than implicit.

But “I” will only ever occur to the left of a “V” or an “X”, never before a “D“. If “I” could occur to the left of a “D“, “MID” would mean 1499, but the proper way to write 1499 is “MCDXCIX”.
So you agree that it would raise a syntax error?
Why it's totally legit 1000 + ( 100 - 1 ) == 1099
You cannot subtract 1 directly from 100, so you need to do 1000 + (100 - 10) + (10 - 1) = MXCIX
> You cannot subtract 1 directly from 100

There isn't a standard for Roman numerals; you can largely do what you want. The Eighteenth Legion used XIIX.

But MIDI is obviously invalid by any standard.

According to this proposal, it would be a syntax error.
Variable names aren't allowed to start with numbers.

You wouldn't expect to name a variable 15D5 would you?

It should be obvious, but please note the date of the proposal.
If this was for perl I'd have believed it without questioning
Not sure why that would help. MIIs didn’t come out until 2006.

/s

A vocal minority of users has also requested support for lower-cased numerals for use in (i) powerpoint slides, (ii) academic work, and (iii) Perl documentation.

I think this made my day

Rationale: ... Besides, the author thinks this is the easiest way to get his name on a PEP.

:D

Let's make INTERCAL great again. Bring it on!
I'm glad this was rejected. The author consideres violations of PEP8 to be broken code that doesn't generate exceptions.

Lots of people treat PEP8 as the word of god, but apparently have not bothered to read it. "Many projects have their own coding style guidelines. In the event of any conflicts, such project-specific guides take precedence for that project."

> I'm glad this was rejected.

It’s an April Fools joke from forever ago…

(comment deleted)
As the descendant of Carthaginians, I find this PEP offensive and disgraceful. If such module is to be introduced, I require that an equivalent "carthaginian" package be also added.

By the way, did you know that the third Punic war officially ended in 1985, just 38 years ago?

OK, why didn't the war officially end when Carthage surrendered in 146BC?

What does "surrender" even mean?

They forgot to fill the paper work, the treaty formally ending the war got signed in 1985.
> They forgot to fill the paper work,

Sorry, without a "/s", can't tell if joking.

Was some form of paperwork requirement the norm for officially ending a war back in 146BC?

Also, how do we know that no treaty was made then? A lot of documents can get lost, or just disintegrate, in 2,000 years.

From Wikipedia[1]:

> Rome still exists as the capital of Italy; the ruins of Carthage lie 16 km (10 mi) east of modern Tunis on the North African coast. A symbolic peace treaty was signed by Ugo Vetere and Chedli Klibi, the mayors of Rome and modern Carthage, respectively, on 5 February 1985; 2,131 years after the war ended. As of 2020 the modern settlement of Carthage was a district of the city of Tunis.

[1]: https://en.wikipedia.org/wiki/Third_Punic_War#Aftermath

> 2,131 years after the war ended.

Edit: But also, that does not answer my question of why Carthage surrendering did not officially end the war.

> third Punic war officially ended in 1985

Enough with the revisionism already!

1985 is about 1500 years after the Western Roman empire perished in 476 CE, and about 2100 years after Carthage city was burned to the ground and the citizen was killed in 146 BC, marking the end of the Carthage civilization.

How is that date "official", exactly?

Seeing this gave me the idea to use Julia's metaprogramming to create a package for this... and of course someone has already done it: https://github.com/anthonyclays/RomanNumerals.jl

Amazingly, R actually seems to support Roman numerals natively: https://stat.ethz.ch/R-manual/R-devel/library/utils/html/rom... Limited numerical range, but seems to have full support for treating them as normal numbers!

The Wolfram Language has some support for converting to and from Roman numerals [1], and Common Lisp's `format` takes a `@R` modifier to print a number as its Roman numeral [2].

[1] https://reference.wolfram.com/language/ref/RomanNumeral.html [2] http://www.lispworks.com/documentation/HyperSpec/Body/22_c.h...

It would be great if we could extend the parser for “ruf” str prefixes in Python to add new string functionality. I’m sure we could subclass str, but using something like rn”XV” would be much nicer!
I had a project a couple years back implementing this and various other 'dead' (rejected) language-level proposals dynamically at the interpreter with just an install of a package, https://github.com/isidentical-archive/pepgrave. Was a fun experience looking back to the history of Python to see all these rejected proposals and getting them to play nice with the current language itself which has significantly evolved since they were proposed.

E.g. here was an implementation of the roman numeral literals PEP, https://github.com/isidentical-archive/pepgrave/blob/master/... which is extremely simple AST manipulation

Look at old latin inscriptions in Europe and you might see IIII instead of IV. Turns out the rules of Roman numerals we know today are a recent convention :)
It's because Romans mostly concerned themselves with counting things, and this is what the system was optimized for.

When you want to add two roman numbers, you just i. put them together, ii. sort the digits in descending order, and iii. shorten all "iiiii" to "v", all "vv" to "x", and so on.

    i.   vii + xiii  -> viixiii
    ii.  viixiii     -> xviiiii
    iii. xviiiii     -> xvv -> xx