People say you shouldn't compare apples and oranges but it seems to work fine for me in Python 3.14, I don't see what the issue is...

@emmatyping

Well, THAT settles an age-old point of #furry contention.

>>> '🦊' > '🐺'
True

@Gyroplast @emmatyping Hmm, I wonder how that works? Maybe it transcribes the emojis to text and the one that appears first in the alphabetical order is deemed the greater one?

So, Apple > Orange means A > O and F > W ?

That's some weird behaviour right here haha

@helloyanis @emmatyping

How does

'🦊' > '🐺' == True

make sense?

Computers are narrow-minded, and do numbers only. Humans don't like numbers much, and wrote all the letters and glyphs they wanted to use with computers on a huge list, and gave every letter a unique number, and called that a "Unicode codepoint" to sound really smart.

The codepoint of FOX FACE (🦊) is 129418, and the codepoint of WOLF FACE (🐺) is 128058.

If I'm asking the lightning-infused rock to compare two single characters, which both emojis really are, it will first implicitly look up their respective codepoints, and compare those numbers. 129418 > 128058 is patently true.

Γ†ons ago, with ASCII, people did a lot of clever things with those "codepoints", like switching between upper and lower case by flipping a single bit of a character, until this broke hilariously with umlauts and their ilk.

"Don't bit-bang or numerically work with ASCII!" is the cautionary tale.

"🦊" U+1F98A: FOX FACE (Unicode Character)

The unicode character U+1F98A (🦊) is named "FOX FACE" and belongs to the Supplemental Symbols and Pictographs block. It is HTML encoded as 🦊.

@Gyroplast @emmatyping After fiddling around, strangely, running

"🦊" == 12948 returns false.

Also, it seems like emojis are always greater than strings with just letters in them, no matter the string length. But the len of "🦊" seems to be only 1 which makes sense, but then why is 🦊 greater than "aaaaaaaaaaaa..." ? That's confusing!

@helloyanis @emmatyping

String comparisons are a massive rabbit hole (heh), and depend entirely on the implementation of a programming language.

In Python, "🦊" == 129418 == False, because you are testing equality of two objects of different types, a str and an int, which is always False as per spec.

The comparison of two strings is done by comparing the numerical value of each character, one by one, and the numerical value of an emoji character is typically rather high, as opposed to an old-school ord("a") == 97. Comparison stops as soon as two compared characters are not equal, you don't need to look at the rest of the string: "z" > "aaa" == True.

Strings (instances of str) compare lexicographically using the numerical Unicode code points (the result of the built-in function ord()) of their characters. 3

It doesn't matter to Python if it's a single character or a string, this was a C thing my addled brain regurgitated. Sowwy.

6. Expressions

This chapter explains the meaning of the elements of expressions in Python. Syntax Notes: In this and the following chapters, grammar notation will be used to describe syntax, not lexical analysis....

Python documentation

@Gyroplast @emmatyping That's great to know, thanks for the insights! 

I'll save this post for later in case I need it! Thanks!

@helloyanis @emmatyping

Oi, I hope you won't need it! :D
This is the kind of arcane implementation detail nobody should ever encounter beyond "always use the intended, provided functions to manipulate, compare or sort strings instead of trying to be clever".

If you run into "collations" in a database context, you can now officially nod sagely, sigh heavily, and feel superior.

@helloyanis @emmatyping

Bonus: printing an "ASCII"-table in 2026 is so much more colorful!

$ python -c "print(ord('🦊'))"
129418
$ python -c "print(ord('🐺'))"
128058
$ python -c "for i in range(ord('🐺'), ord('🐺') + 40): print(chr(i), end='')"
πŸΊπŸ»πŸΌπŸ½πŸΎπŸΏπŸ‘€πŸ‘πŸ‘‚πŸ‘ƒπŸ‘„πŸ‘…πŸ‘†πŸ‘‡πŸ‘ˆπŸ‘‰πŸ‘ŠπŸ‘‹πŸ‘ŒπŸ‘πŸ‘ŽπŸ‘πŸ‘πŸ‘‘πŸ‘’πŸ‘“πŸ‘”πŸ‘•πŸ‘–πŸ‘—πŸ‘˜πŸ‘™πŸ‘šπŸ‘›πŸ‘œπŸ‘πŸ‘žπŸ‘ŸπŸ‘ πŸ‘‘