I love Python to pieces...

... but ...

I desperately hate when a string gets interpreted as a list and suddenly I'm tracing down a bunch of single-character nonsense.

['f', 'u', 'c', 'k', ' ', 't', 'h', 'a', 't', ' ', 's', 'h', 'i', 't']

· tootstream · 0 · 0 · 8

Today I feel accomplished that more than a handful of people sent me code saying "fuck that shit" split into individual characters.

Truly we live in amazing times.

@cwebber @craigmaloney ['I', ' ', 't', 'h', 'o', 'u', 'g', 'h', 't', ' ', 'i', 't', ' ', 'w', 'a', 's', ' ', 'j', 'u', 's', 't', ' ', 'm', 'e', '!']

(I ended up writing a one liner for a joke...).

@craigmaloney I've never gotten why every modern language seems to do weird stuff with its variable types. (Speaking as someone who has first and second years CS all in C and C++, plus BASIC in high school)

@craigmaloney We've got to go deeper

[['f'], ['u'], ['c'], ['k'], [' '], ['t'], ['h'], ['a'], ['t'], [' '], ['s'], ['h'], ['i'], ['t']]

@balrogboogie @craigmaloney There's also the JSON API version

{"string": [{"character": "f"}, {"character": "u"}, {"character": "c"}, {"character": "k"}, {"character": " "}, {"character": "t"}, {"character": "h"}, {"character": "a"}, {"character": "t"}, {"character": " "}, {"character": "s"}, {"character": "h"}, {"character": "i"}, {"character": "t"}]}

@balrogboogie @zigg @craigmaloney nah, I mean EDI. It's an older standard for document exchange, and is generally a pain to work with.

@craigmaloney i may have code like assert not isinstantce(v, str) in some of my code.

Sign in to participate in the conversation

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!