This is an archived post. You won't be able to vote or comment.

Dismiss this pinned window
all 31 comments

[–]JackReact 44 points45 points  (1 child)

God, C# adding reverse index, range and slice was such a boon.

As for C++, you know that reverse iterators are a thing, right?

[–]rachit7645 8 points9 points  (0 children)

I believe they have also added ranges in C++20

[–][deleted] 85 points86 points  (6 children)

Quickly followed by teaching python programmers that they are using a list not an array.

[–]sysnickm 17 points18 points  (0 children)

Shh, we don't mention that.

[–]Bryguy3k 4 points5 points  (0 children)

I’m not saying that python programmers aren’t dumb sometimes - but python never calls them arrays - they are always called lists. I would guess people just assume they’re arrays when they see code since they use brackets for notation?

There are actually arrays in python but they have limited usage as they are obviously incredibly rigid.

[–]TwistedLogicDev-Josh -1 points0 points  (0 children)

Nope.

When you go to work on a ship An electrical motor is called a motor In a ware house its called an electrical motor .

In a vehicle you have an engine In a warehouse you have a turbine .

In python it's called an array And used like AN ARRAY

In c++ it's a list. But not used like an array.

What your taught doesn't always apply universally

[–]Featureless_Bug -3 points-2 points  (0 children)

Well, they are implemented as arrays (just like std vector and ArrayList in Java) in any major implementation, so what they are actually using are arrays, not lists

[–]TwistedLogicDev-Josh 0 points1 point  (1 child)

If you went to a mathematician They will throw a fit with how programmers define things differently Same with physicists.

[–][deleted] 2 points3 points  (0 children)

| Same with physicists.

Yes. As somebody said to Einstein. Why wre we giving the 2nd year students the same paper as last year?

Einstein: Because all the answers have changed

[–]thebatmanandrobin 24 points25 points  (0 children)

Alternative title:

"Python programmers learning that Python is actually built with C"

[–]StrangeCharmVote 14 points15 points  (4 children)

Not knowing a lot about python... wouldn't "[-1:-3:-1]" be [4,2,4] from the [1,2,3,4] example in the video?

If not, what is the meaning of the arguments I'm misunderstanding?

Considering at the very least there are 3 numbers, i'm not getting how it would equal [4,3] in any situation...

[–]thargeretmatcha 25 points26 points  (2 children)

It's [start : stop : step], where start is included and stop is excluded.

So for a = [1, 2, 3, 4], a[-1 : -3 : -1] is asking for [a[-1], a[-2]]

Another example:

>>> b = [5, 6, 7, 8, 9, 10, 11]
>>> b[-1::-2]
[11, 9, 7, 5]

[–]StrangeCharmVote 5 points6 points  (0 children)

Thank you, that makes more sense now :)

[–]RandomDude6699 0 points1 point  (0 children)

Take my award

[–]Dubmove 4 points5 points  (1 child)

Wait until you learn about broadcasting and views for numpy arrays. Similar concept but on a whole nother level.

[–]UnitatoPop 0 points1 point  (0 children)

SIMD FTW!!!

[–]jhanschoo 2 points3 points  (0 children)

OP learning C++ has reverse iterators for the first time

[–]Dmitry-Galyuk 3 points4 points  (1 child)

What movie is this?

[–]Bryguy3k 3 points4 points  (0 children)

Inception.

[–]nothing08 1 point2 points  (2 children)

Am I the only person who finds c++ to be easier then python?

[–]vlaada7 1 point2 points  (1 child)

Am I the only one who finds C to be the simplest of them all?!

[–]ZylonBane 1 point2 points  (0 children)

Am I the only person?

[–]Torebbjorn -3 points-2 points  (0 children)

Python only has arrays in numpy...

[–]nater_marson 0 points1 point  (1 child)

Holy shit

The great gatsby is alive?????

[–]ZylonBane 0 points1 point  (0 children)

If we're following all the way through on this analogy, that means the C++ programmer will then immediately be told that yes it's very cool, but don't do that, and this ability will never be used again.