« first day (1627 days earlier)      last day (3319 days later) » 

7:00 PM
The justification is that it's ambiguous:
>>> str(17) > "2"
False
>>> 17 > int("2")
True
 
Since Python is strongly typed, it doesn't make sense to compare things of different types, just like 1 + "1" doesn't make sense.
 
Ok, is that the dev's stated reason for the change, or is that a post-hoc justification that sounds good?
 
The questions were these:
7
Q: Why does this key class for sorting heterogeneous sequences behave oddly?

Zero PiraeusPython 3.x's sorted() function cannot be relied on to sort heterogeneous sequences, because most pairs of distinct types are unorderable (numeric types like int, float, decimal.Decimal etc. being an exception): Python 3.4.2 (default, Oct 8 2014, 08:07:42) [GCC 4.8.2] on linux Type "help", "cop...

18
Q: How can I get 2.x-like sorting behaviour in Python 3.x?

Zero PiraeusI'm trying to replicate (and if possible improve on) Python 2.x's sorting behaviour in 3.x, so that mutually orderable types like int, float etc. are sorted as expected, and mutually unorderable types are grouped within the output. Here's an example of what I'm talking about: >>> sorted([0, 'on...

 
I'm pretty sure it's mentioned in the changelog somewhere.
 
DSM
@Kevin: no, that's the real reason. Some of us have been arguing that the original behaviour is a design flaw for, well, decades.
(Okay, not quite 20 years, but a long, long time.)
 
7:03 PM
I'm defending an answer of mine on the site, and I'm about to make a comment like "sorting a mixed list of strings and ints is not Pythonic" and I'm trying hard not to put my foot in my mouth
If I could get a quote from GvR saying "yeah you should never need to compare strings and ints", that would decisively win the argument for me.
 
DSM
I think Alex M may have had a post on this subject.
 
"There is no single obvious ordering for a mix of ints and strings, so in 3.x such a sequence can't be sorted".
 
But without any backup, the other guy will just fire back, "you think having mixed types in a list is nonpythonic? We have duck typing for a reason, dude"
 
DSM
Ah, this is the post I was thinking of, but unfortunately it's not quite on point.
 
On second thought, I'm arguing against what I thought the guy said, and not what he actually said. I pretty much agree with the non-imaginary one.
So I think I'll just make no comment.
 
7:08 PM
> The ordering comparison operators (<, <=, >=, >) raise a TypeError exception when the operands don’t have a meaningful natural ordering. Thus, expressions like 1 < '', 0 > None or len <= len are no longer valid, and e.g. None < None raises TypeError instead of returning False. A corollary is that sorting a heterogeneous list no longer makes sense – all the elements must be comparable to each other.
 
You can still make different things orderable by overriding their special methods.
 
DSM
Always a play. Better be silent and thought a fool, etc.
 
So the justification – "the operands don’t have a meaningful natural ordering" – is in the docs.
 
I just tried it out. Make two classes and compare their instances, it's an error. Give the first class a __gt__ method and you get a result.
 
The justification I would think of is "this ain't PHP."
 
7:09 PM
I got a bit snippy with my earlier "post-hoc justification" message and I apologize
 
@Kevin did you see my book recommendation from yesterday? It got buried kinda quickly.
 
Didn't sound snippy to me ... it's a fair question, and either answer is plausible.
 
@davidism "The First Fifteen Lives of Harry August"? Yeah, I have taken a note of it for future reading - the premise sounds fascinating.
I'm very interested in fiction that discusses the failure modes of different kinds of immortality. I would prefer to live forever given the chance, and I'd like to know what pitfalls to look out for.
Don't let the immortality pill manufacturer go out of business, don't let the sun explode, don't institute yourself as god-king and get deposed and thrown into a black hole. And so on.
 
The author was pretty thorough, although there was one possible thing I thought of that wasn't explored.
It wasn't a plothole, just another mechanic that seemed useful.
 
I wonder if it's available at my local library.
 
7:16 PM
That's something I always forget to check. The library is literally a block away from me, too!
 
This reminds me of a bit of (very) short fiction regarding reliving one's life: Meeting Sarah. It's by the guy who wrote "The Egg", which people seem to like
 
@Kevin Don't get trapped in a universe prone to heat death ;-)
 
If we're talking about true immortality, then we're already breaking the second law of thermodynamics :-)
I could pump additional negentropy into the universe just by turning a crank with my inexhaustible strength.
(I'm assuming here that immortality implies that there will never be a point where I have no energy to move or breathe or think, because that sounds a lot like death to me)
 
@Kevin Don't get trapped in a universe with a second law of thermodynamics ;-D
 
Good advice.
 
7:21 PM
well this is a little weird...
 
Nothing weird about a little weirdness.
 
moment().add(8, 'weeks'); gives me 4 days ago
 
What's moment()?
 
7 more moves to win StackEgg again, everybody vote!
 
moment is a javascript library for handling time and dates, like datetime in python
 
7:25 PM
Maybe moment() is returning the wrong value.
 
nah, checked that, got the right time for now
 
Is it 4 days ago, but 2 months in the future?
drops the mic
 
oh dur I am a huge idiot
 
maybe the argument to add isn't what you expect
 
DSM
@QuestionC: nicely done.
 
7:30 PM
Aww man, you (removed) my insight.
 
Like, it wants "week" and not "weeks", and giving an unexpected string causes undefined behavior rather than crashing like a good project.
 
DSM
@Kevin: does one of your userscripts block messages from QC? :-)
 
yeah pretty embarrassing. I just forgot it was still March. It's way too hot outside to still be March
 
Nah, my mental "posts to make" buffer was consuming all my processing cycles. I couldn't read any messages until I finished writing.
Comedy alternative: Once you eliminate the impossible, whatever remains must be the truth. We weren't done eliminating everything that wasn't the problem, so it stands to reason that we couldn't have found the solution yet.
Aaand I'm back under the rep cap because a post I made was both upvoted and totally incorrect.
I could salvage it and undelete, but... Meh
 
DSM
Yeah, when I realize I've made a wrong step I only bother salvaging if the other answers are too awful to bear leaving alone.
 
7:40 PM
Someone else already got the accept, so I'm bowing out
 
7:59 PM
I think my guardian angel is trying to push me back over the cap :-)
 
picks absentmindedly at wings, adjusts halo
 
Heh, I like the first comments on this Physics post
 
Is "wiggles per second" an SI unit?
 
Nerd snipe warning: I'm actually trying to figure out the units
 
I just saw the second comment. Hilarious!
 
8:04 PM
A wiggle is like, 1/60th of a rotation.
 
DSM
Colleagues had to start work early today. I wish they weren't staying until the usual hour: makes me look bad.
 
I, too, have overly competent coworkers that make me look bad.
I spent a day or three trying to install some software and kept getting "couldn't find [obscure file name]" errors. Coworker got it working on the first try.
Now it seems like I spent an hour trying, and 71 hours playing Minesweeper. Not so.
 
user4433485
8:30 PM
Cabbage!
 
morning
I found a place that sells wild game near my house, everything is now awesome
 
Yum, depending on the game.
 
What's with the "+1" in the title of the other one?
 
can't close as dupe, but I'll put a custom close reason
> This question is off topic because it is about the internal behavior of a Google API, not a question about a programming problem.
@WayneConrad because otherwise the title would be a duplicate, which isn't allowed anymore
 
8:45 PM
Ah.
 
Which I've now commented on as well. Both those questions should still be closed.
 
There's my vote.
 
DSM
9:05 PM
Three answers, none of them right, but all of them close enough it's not worth a new answer from me.
 
9:16 PM
Anybody know why I'm running a command in Windows with rst2html.py, and I'm getting stuck in a endless mbcs loop?
 
user4396006
cabbage @davidism what does it change the title to have a "+1" for it not to be a duplicate?
 
user4396006
Doesn't the system detect that they have exactly the same title?
 
They do, which is why the author then put "+1" in front of the duplicate title.
 
user4396006
I mean if they do not detect it even though they add the +1 thing
 
How would you propose they do that as a general solution? You're basically getting into machine learning territory.
 
user4396006
9:20 PM
Well, it is clearly the same problem, so the same question
 
user4396006
I thought they had really strict algorithms analyzing the titles
 
user4396006
I though they could detect the +1 thing
 
user4396006
But I clearly see they don't
 
No, it's a regex, anything more complicated is not worth it.
 
user4396006
That's why moderators exist :D
 
9:21 PM
What if they put "Plus Two"? Or "My New Title"
 
DSM
That's why we exist.
 
user4396006
@DSM exactly.
 
We're not moderators.
 
user4396006
I know, but he still says so.
 
Also, I'm really confused about what this conversation is about now.
 
DSM
9:23 PM
Moderators are only supposed to step in when there's something we can't handle. Voting to close is something we can handle on our own.
 
user4396006
Just about the topic we've ended up discussing @davidism
 
user4396006
@DSM yes, but you have called yourself a moderator.
 
DSM
?
 
user4396006
That's why we exist. You said
 
DSM
Maybe it would be clearer if I said "No, you're wrong; that's not why moderators exist, that's not their responsibility. It's our responsibility."
 
user4396006
9:24 PM
Ah ok, I supposed you meant that you were one of them
 
user4396006
Excuse me
 
DSM
Italics are sometimes used for emphasizing contrast.
 
It's really easy to tell who's a moderator. They have a diamond symbol to the right of their name, and show up blue in chat.
 
user4396006
@DSM ok. :D
 
DSM
I guess I could get Kevin to write a script which makes me look like a moderator, and then encourage other people to run it.
 
9:32 PM
Re: this room has been sacrificing cute animals: meta.stackoverflow.com/questions/289057/… (10k only)
> Is stack-overflow moderation so out-of-control that it has spawned a new religious cult?
 
DSM
Time to shut 'er down. rhubarb for all!
 
I want a keyboard waffle maker
 
10:10 PM
Kimchi.
 
Cabbage.
 
Coleslaw!
 
 
1 hour later…

« first day (1627 days earlier)      last day (3319 days later) »