Tim Ottinger Profile picture
Technically adept, practical, a good communicator, ethical, and committed to team development and personal growth. @IndustrialLogic & @ModernAgile.

Aug 17, 2020, 5 tweets

So,
x.append(y)
vs
x = x + [y]
vs
x += [y]
vs
x = list(itertools.chain(x,[y])
vs
<something even worse here>

worse:
x[len(x)]=y

It's fun to find horrible and wrong ways to do perfectly fine things. As long as it's twitter and not production code!

x = *[*x],y

I don't know if you can make it much worse in python.
I may have hit a local maximum.

No, wait. I have something even more heinous maybe:

x = eval(', '.join(f'{i}' for i in x) + f', {y}')

Ever think of something so awful it makes you cringe?
That last python perversion might be it.

Share this Scrolly Tale with your friends.

A Scrolly Tale is a new way to read Twitter threads with a more visually immersive experience.
Discover more beautiful Scrolly Tales like this.

Keep scrolling