Follow

I think Python interprets a string of 0s and 1s as binary. Fucking hell.

· · Web · 7 · 1 · 2
@matrix thats what you get for trying to code with facts and logic. Not gut feeling and aryan blood memory.

@matrix@gameliberty.club You should know that's how loosely typed programming languages work. It's easily fixed by wrapping i into str(i).

@SuperDicq @matrix except thats exactly what print() is doing already?

@matrix or I guess print(type(i[0])) since the type of i would just be a list.

@matrix No, it's because `str.split()` doesn't work:
>>> 'abcd'.split()
['abcd']
@matrix I've hit the same problem... A couple of days ago or something. :D
@matrix Setting it to '' doesn't help, it raises ValueError, setting to None doesn't help, since that's default value.
But casting the string to a list does:
>>> list('abcd')
['a', 'b', 'c', 'd']

@matrix Python is cancer. I cannot set my card PIN to 0077 because, according to my internet banking, this PIN is a part of my card number. My card number is 1234123477341234, i.e. it contains "77". They probably use Python too.

@fuxoft @matrix
Ok... it seems my brain ain't exactly at the peak performance today :omegalul:

@matrix thats a result of str(i[0]) idk what youre expecting, it isnt interpreting as binary
@matrix if you do want binary you can use 0b prefix like 0b01001100

@wowaname @matrix It does with compiler extensions. Gcc here, I know clang is fine with it too, and even tcc, and I'm guessing probably everything else

@EnjuAihara I know. I'm retarded. I know you shouldn't copy old code.

Sign in to participate in the conversation
Game Liberty Mastodon

Mainly gaming/nerd instance for people who value free speech. Everyone is welcome.