Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Pissthon Algebra

Name: Anonymous 2022-10-31 18:14

So you think [1,2]*2 = [2,3]?
Think harder you dumb nigger!
Because in Python [1,2]*2 == [1,2,1,2]

Name: Anonymous 2022-11-01 7:54

For a while I thought Pissthon was some mathematician who made an obscure algebraic system, and I was trying to figure out why 1*2 = 2 but 2*2 = 3.

And if you're super retarded and believe that xs[0:4:1] is just xs[4:0:-1] reversed, then think twice, because Pissthon is not your african mathematics where everything is symmetric.

The only justification for this design I could find (start inclusive, end exclusive) is that it allows [:3] to select the first 3 characters, and [3:] to select everything but the first 3.

"But wait! How can I get [7, 6, 5, 4, 3, 2, 1]" - a mental midget will ask in vain, missing the obvious fact that Pukethon provides no way to reverse a list with a [start:stop] range.

That is not correct. When splicing lists over their entire length, you should either not specify end at all, or use None (in case you are using a variable to control it). For example:

xs = [1, 2, 3, 4, 5, 6, 7]
xs[0::1] -> [1, 2, 3, 4, 5, 6, 7]
xs[0:None:1] -> [1, 2, 3, 4, 5, 6, 7]
xs[6::-1] -> [7, 6, 5, 4, 3, 2, 1]
xs[6:None:-1] -> [7, 6, 5, 4, 3, 2, 1]


In fact, depending on whether the step is positive or negative, python seems to assume appropriate values for start and end automatically, thus enabling you to write the following

xs[::1] -> [1, 2, 3, 4, 5, 6, 7]
xs[::-1] -> [7, 6, 5, 4, 3, 2, 1]


Same logic applies to numeric ranges, therefore range(0,10,-2) != range(10,0,-2)

Well, of course it does. You do understand that arrays are zero indexed, yes? Making the end exclusive makes iterating over arrays more intuitive.

Now, I do realize this is a humorous post, and it's assuming the persona of an outraged moron for comedic effect (and it's quite funny, I rate it 3/5), but I thought I'd clear up possible misunderstandings it might cause to the reader who takes it seriously.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List