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

Since this is trending, I'll take this opportunity to recommend folks fill out the Python Developers Survey!

https://fosstodon.org/@ThePSF/116107799932161585

@emmatyping i prefer green apples personally
@emmatyping What do you mean? It has utterly failed! It got it completely backwards even. SMH.
@nazokiyoubinbou I regret to inform you the results are quite consistent across Apples.
@emmatyping This is so horrendously wrong...  
@nazokiyoubinbou @emmatyping Technically I think the result depends on locale. So you could create a custom locale just for your tastes!
@emmatyping It's not even just in Pyhon...
@emmatyping oh great, now we're going to have to know this stuff when manually lexically sorting records with emoji in their titles.
@emmatyping I'd also say that python is wrong but I guess my beef is with the unicode consortium.
@emmatyping that's because they sre string, not 🍎 and 🍊. Also, I'm pretty sure `class 🍎: ...` is invalid python but I could be wrong
@emmatyping PHP also doesn't have a problem comparing them!
@emmatyping is this just comparing their place on the Unicode table?
@0x4d6165 Yup! red apple is U+1F34E, while tangerine is U+1F34A, so red apple compares greater than tangerine!
@emmatyping @0x4d6165 i'm curious, how does a screenreader handle emoji? Do they say "tangerine emoji"?
@emmatyping
Well, it's not a statically-typed language. In Rust you'd have to define some kind of Fruit trait.
Rust Playground

A browser interface to the Rust compiler to experiment with the language

@emmatyping
Thanks for fact-checking my joke, I nearly encouraged people to learn how Rust traits work on a Saturday night, but you saved them.
@emmatyping
That's not python - with 3.14 it's pi-thon πŸ€ͺ
@vampirdaddy @emmatyping do future versions of pi-thon just keep appending digits of pi to the version number?
@emmatyping this is why Python is the best
Python version 3.14, or as I like to call it, Ο€-thon
@emmatyping
If this were javascript, itd be in a compilation about why javascript is a bad language.
Apples and Oranges β€” A Comparison

by Scott A. Sandford, NASA Ames Research Center, Mountain View, California From the AIRCHIVES, Volume 1, Issue 3 We have all been present at discussions (or arguments) in which one of the combatant…

Improbable Research
I'm not certain that the correct answer, though. πŸ€”
@emmatyping I think some people might riot when they see this comparison.
@emmatyping I don't really know how to write even basic #Python scripts anymore, but I still miss being able compare strings like that, or concatenating them with "+", when I'm working with #RStats
@leonardof @emmatyping Comparing works fine in #Rstats (in Dutch it is apples and pears)

@dodecadron @emmatyping

Hah! Lack of concatenation with + deceived me about it being possible to do "math" with strings, er, character vectors in R. I don't think I ever saw someone comparing them with greater-than, too. Must play around in the REPL some more!!

@emmatyping that's not true at all, oranges are better. Actually I believe every fruit is unique and should be appreciated except persimmon.
@emmatyping so what is the boss fruit that can beat the apple?
@emmatyping It's fine to compare them as long as you don't conclude they are equal
@emmatyping It's probably just a C thing: If you compare "🍎" > "🍊" in C you either get true or false depending on how the compiler felt when it compiled the binary.
@emmatyping
Humor me and either turn the fruit around or use '<'
@emmatyping You've reduced them to a shared domain!

@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='')"
πŸΊπŸ»πŸΌπŸ½πŸΎπŸΏπŸ‘€πŸ‘πŸ‘‚πŸ‘ƒπŸ‘„πŸ‘…πŸ‘†πŸ‘‡πŸ‘ˆπŸ‘‰πŸ‘ŠπŸ‘‹πŸ‘ŒπŸ‘πŸ‘ŽπŸ‘πŸ‘πŸ‘‘πŸ‘’πŸ‘“πŸ‘”πŸ‘•πŸ‘–πŸ‘—πŸ‘˜πŸ‘™πŸ‘šπŸ‘›πŸ‘œπŸ‘πŸ‘žπŸ‘ŸπŸ‘ πŸ‘‘
@emmatyping oh! This is great! I was always given the example that Β«you cannot compares apple to orangesΒ» I took it for granted but always was uncomfortable on why. So either this is a revolutionary discovery or they finally fxed it?
Anyway will find opportunities to apply it in production code.
@emmatyping I..... have questions....
First image: my PC.. MX Linux, python 3.13.5, Kitty terminal emulator, agrees with the OP's findings.
Second image: my roommate's PC, MX Linux, Python 3.13.5, Konsole terminal emulator, disagrees with both OP and I..

@emmatyping You were told not to do this.

You knew better.

Are you ready for the aftermath? All the angry orange loving people? How they will respond to this?

This is not gonna be pretty...