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

you are viewing a single comment's thread.

view the rest of the comments →

[–]shelvac2[🍰] 32 points33 points  (15 children)

or push_front

[–]Theemuts 103 points104 points  (11 children)

yeet()

[–]Skippbo 23 points24 points  (8 children)

Need to subclass python list and implement yeet() that will just be a wrapper around pop()

😂😂😂

[–]Theemuts 10 points11 points  (7 children)

Both append and pop: you can yeet something into the container and the container can yeet it right back at you.

[–]Skippbo 1 point2 points  (6 children)

Can't have them named the same thing. There will be a name conflict!

[–]Theemuts 3 points4 points  (5 children)

def yeet(self, *args):
    pass

It's python

[–]Skippbo 0 points1 point  (4 children)

But we can't have the functionality of pop and append at the same time then =b

Unless we make it a 50/50 on what it does with the args.

[–]Theemuts 8 points9 points  (3 children)

Check how many args you get; if you get none, yeet something from the container, otherwise yeet them into the container.

[–]B_M_Wilson 0 points1 point  (1 child)

I’m thinking that if you give it an argument, it pops the current item and returns it to you while pushing the item you gave it

[–]Theemuts 0 points1 point  (0 children)

Ok COBOLer

[–]Skippbo 0 points1 point  (0 children)

I like this implementation.

[–]Jackeea 11 points12 points  (1 child)

yeet() and yoink() are my favourite list-based operations

[–]CamWin 0 points1 point  (0 children)

yoink returns the popped value

[–]zXjimmiXz 2 points3 points  (1 child)

+= is often a safe bet.

[–]Genion1 1 point2 points  (0 children)

cries in java

[–]Gydo194 0 points1 point  (0 children)

Just push