Craig Maloney ☕ ✅ is a user on octodon.social. You can follow them or interact with them if you have an account anywhere in the fediverse. If you don't, you can sign up here.
Craig Maloney ☕ ✅ @craigmaloney

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 · 9

@craigmaloney ['v', 'a', 'p', 'o', 'r', 'w', 'a', 'v', 'e']

@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 @craigmaloney The effort-to-funny ratio for XML is too high 😄

@zigg @balrogboogie @craigmaloney

<?xml version="1.0" encoding="UTF-8" ?>
<root>
<string>
<character>f</character>
</string>
<string>
<character>u</character>
</string>
<string>
<character>c</character>
</string>
<string>
<character>k</character>
</string>
...
</root>

@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.

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.